Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Development
openfoam
Commits
64fe6718
Commit
64fe6718
authored
Nov 02, 2010
by
Andrew Heather
Browse files
ENH: Added isAbsolute() function to fileName class
parent
6d70677d
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/OpenFOAM/db/IOobject/IOobject.C
View file @
64fe6718
...
...
@@ -64,9 +64,7 @@ bool Foam::IOobject::IOobject::fileNameComponents
return
false
;
}
string
::
size_type
first
=
path
.
find
(
'/'
);
if
(
first
==
0
)
if
(
path
.
isAbsolute
())
{
// called with absolute path
WarningIn
(
"IOobject::fileNameComponents(const fileName&, ...)"
)
...
...
src/OpenFOAM/db/dictionary/functionEntries/includeEntry/includeEntry.C
View file @
64fe6718
...
...
@@ -72,7 +72,7 @@ Foam::fileName Foam::functionEntries::includeEntry::includeFileName
fName
.
expand
();
// relative name
if
(
fName
.
size
()
&&
fName
[
0
]
!=
'/'
)
if
(
fName
.
size
()
&&
!
fName
.
isAbsolute
()
)
{
fName
=
fileName
(
is
.
name
()).
path
()
/
fName
;
}
...
...
src/OpenFOAM/global/argList/argList.C
View file @
64fe6718
...
...
@@ -315,7 +315,7 @@ void Foam::argList::getRootCase()
casePath
=
cwd
();
options_
.
erase
(
"case"
);
}
else
if
(
casePath
[
0
]
!=
'/'
&&
casePath
.
name
()
==
".."
)
else
if
(
!
casePath
.
isAbsolute
()
&&
casePath
.
name
()
==
".."
)
{
// avoid relative cases ending in '..' - makes for very ugly names
casePath
=
cwd
()
/
casePath
;
...
...
@@ -334,7 +334,7 @@ void Foam::argList::getRootCase()
// Set the case and case-name as an environment variable
if
(
rootPath_
[
0
]
==
'/'
)
if
(
rootPath_
.
isAbsolute
()
)
{
// absolute path - use as-is
setEnv
(
"FOAM_CASE"
,
rootPath_
/
globalCase_
,
true
);
...
...
src/OpenFOAM/primitives/strings/fileName/fileName.C
View file @
64fe6718
...
...
@@ -54,6 +54,13 @@ Foam::fileName::Type Foam::fileName::type() const
}
bool
Foam
::
fileName
::
isAbsolute
()
const
{
fileName
fName
(
*
this
);
return
fName
.
size
()
&&
fName
.
operator
[](
0
)
==
'/'
;
}
//
// * remove repeated slashes
// /abc////def --> /abc/def
...
...
src/OpenFOAM/primitives/strings/fileName/fileName.H
View file @
64fe6718
...
...
@@ -138,10 +138,15 @@ public:
// eg, remove repeated slashes, etc.
fileName
clean
()
const
;
// Interogation
//- Return the file type: FILE, DIRECTORY or UNDEFINED
Type
type
()
const
;
// Interrogation
//- Return the file type: FILE, DIRECTORY or UNDEFINED
Type
type
()
const
;
//- Return true if file name is absolute
bool
isAbsolute
()
const
;
// Decomposition
...
...
@@ -163,6 +168,7 @@ public:
//- Return a single component of the path
word
component
(
const
size_type
,
const
char
delimiter
=
'/'
)
const
;
// Member operators
// Assignment
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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