Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
931bd1d6
Commit
931bd1d6
authored
Mar 14, 2019
by
Mark Olesen
Committed by
Andrew Heather
Mar 14, 2019
Browse files
STYLE: consistent handling of fileName concatenation (POSIX)
parent
d2eb5083
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/OSspecific/POSIX/POSIX.C
View file @
931bd1d6
...
...
@@ -99,16 +99,24 @@ static inline Foam::fileName fileNameConcat
if
(
b
.
size
())
{
// Two non-empty strings: can concatenate
return
Foam
::
fileName
((
a
+
'/'
+
b
),
false
);
if
(
a
.
back
()
==
'/'
||
b
.
front
()
==
'/'
)
{
return
Foam
::
fileName
(
a
+
b
,
false
);
}
else
{
return
Foam
::
fileName
(
a
+
'/'
+
b
,
false
);
}
}
// The second string was empty
return
Foam
::
fileName
(
a
,
false
);
}
// Or, if the first string is empty
if
(
b
.
size
())
{
// The first string is empty
return
Foam
::
fileName
(
b
,
false
);
}
...
...
@@ -1586,21 +1594,22 @@ int Foam::system(const Foam::UList<Foam::string>& command, const bool bg)
}
void
*
Foam
::
dlOpen
(
const
fileName
&
lib
,
const
bool
check
)
void
*
Foam
::
dlOpen
(
const
fileName
&
lib
Name
,
const
bool
check
)
{
if
(
POSIX
::
debug
)
{
std
::
cout
<<
"dlOpen(const fileName&)"
<<
" : dlopen of "
<<
lib
<<
std
::
endl
;
std
::
cout
<<
"dlOpen(const fileName&)"
<<
" : dlopen of "
<<
libName
<<
std
::
endl
;
}
void
*
handle
=
::
dlopen
(
lib
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
void
*
handle
=
::
dlopen
(
lib
Name
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
#ifdef darwin
// Re-try "libXX.so" as "libXX.dylib"
if
(
!
handle
&&
lib
.
hasExt
(
"so"
))
if
(
!
handle
&&
lib
Name
.
hasExt
(
"so"
))
{
const
fileName
dylib
(
lib
.
lessExt
().
ext
(
"dylib"
));
handle
=
::
dlopen
(
dylib
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
const
fileName
dylib
Name
(
libName
.
lessExt
().
ext
(
"dylib"
));
handle
=
::
dlopen
(
dylib
Name
.
c_str
(),
RTLD_LAZY
|
RTLD_GLOBAL
);
}
#endif
...
...
@@ -1615,7 +1624,7 @@ void* Foam::dlOpen(const fileName& lib, const bool check)
{
std
::
cout
<<
"dlOpen(const fileName&)"
<<
" : dlopen of "
<<
lib
<<
" : dlopen of "
<<
lib
Name
<<
" handle "
<<
handle
<<
std
::
endl
;
}
...
...
src/OSspecific/POSIX/POSIX.H
View file @
931bd1d6
...
...
@@ -48,7 +48,7 @@ namespace Foam
namespace
POSIX
{
//- Declare name
of the class
and its debug switch
//- Declare name
space
and its debug switch
NamespaceName
(
"POSIX"
);
const
label
pathLengthChunk
=
256
;
...
...
src/OpenFOAM/primitives/strings/fileName/fileName.C
View file @
931bd1d6
...
...
@@ -495,7 +495,8 @@ Foam::fileName Foam::operator/(const string& a, const string& b)
}
}
return
a
;
// The second string was empty
// The second string was empty
return
a
;
}
if
(
b
.
size
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment