Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
O
ogs
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yuhao Liu
ogs
Commits
f5289f19
Commit
f5289f19
authored
12 years ago
by
Dmitri Naumov
Committed by
Dmitrij Naumov
12 years ago
Browse files
Options
Downloads
Patches
Plain Diff
extractPath() returns result now.
parent
02690a5a
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
BaseLib/FileTools.cpp
+5
-6
5 additions, 6 deletions
BaseLib/FileTools.cpp
BaseLib/FileTools.h
+2
-4
2 additions, 4 deletions
BaseLib/FileTools.h
FileIO/Legacy/OGSIOVer4.cpp
+2
-4
2 additions, 4 deletions
FileIO/Legacy/OGSIOVer4.cpp
with
9 additions
and
14 deletions
BaseLib/FileTools.cpp
+
5
−
6
View file @
f5289f19
...
...
@@ -90,8 +90,7 @@ std::string copyPathToFileName(const std::string &file_name, const std::string &
pos
=
file_name
.
rfind
(
"
\\
"
);
// windows delimiter
if
(
pos
==
std
::
string
::
npos
)
{
std
::
string
path
;
BaseLib
::
extractPath
(
source
,
path
);
std
::
string
path
=
BaseLib
::
extractPath
(
source
);
return
path
.
append
(
file_name
);
}
else
return
std
::
string
(
file_name
);
...
...
@@ -99,16 +98,16 @@ std::string copyPathToFileName(const std::string &file_name, const std::string &
else
return
std
::
string
(
file_name
);
}
void
extractPath
(
std
::
string
const
&
fname
,
std
::
string
&
path
)
std
::
string
extractPath
(
std
::
string
const
&
path
name
)
{
// extract path for reading external files
size_t
pos
(
f
name
.
rfind
(
"/"
));
// linux, mac delimiter
size_t
pos
(
path
name
.
rfind
(
"/"
));
// linux, mac delimiter
if
(
pos
==
std
::
string
::
npos
)
{
pos
=
f
name
.
rfind
(
"
\\
"
);
// windows delimiter
pos
=
path
name
.
rfind
(
"
\\
"
);
// windows delimiter
if
(
pos
==
std
::
string
::
npos
)
pos
=
0
;
}
path
=
f
name
.
substr
(
0
,
pos
==
0
?
pos
:
pos
+
1
);
return
pathname
.
substr
(
0
,
pos
==
0
?
pos
:
pos
+
1
);
}
}
// end namespace BaseLib
...
...
This diff is collapsed.
Click to expand it.
BaseLib/FileTools.h
+
2
−
4
View file @
f5289f19
...
...
@@ -64,11 +64,9 @@ std::string getSuffixFromPath(const std::string &str);
std
::
string
copyPathToFileName
(
const
std
::
string
&
file_name
,
const
std
::
string
&
source
);
/**
* extracts the path of a fully qualified path name of the file
* @param fname [input] the fully qualified path name of the file
* @param path [output] the path of the fully qualified path name of the file
* Extracts the path of a pathname.
*/
void
extractPath
(
std
::
string
const
&
fname
,
std
::
string
&
path
);
std
::
string
extractPath
(
std
::
string
const
&
path
name
);
}
// end namespace BaseLib
#endif // FILETOOLS_H
This diff is collapsed.
Click to expand it.
FileIO/Legacy/OGSIOVer4.cpp
+
2
−
4
View file @
f5289f19
...
...
@@ -556,8 +556,7 @@ bool readGLIFileV4(const std::string& fname, GEOObjects* geo, std::string& uniqu
geo
->
addPointVec
(
pnt_vec
,
unique_name
,
pnt_id_names_map
);
// KR: insert into GEOObjects if not empty
// extract path for reading external files
std
::
string
path
;
BaseLib
::
extractPath
(
fname
,
path
);
const
std
::
string
path
=
BaseLib
::
extractPath
(
fname
);
// read names of plys into temporary string-vec
std
::
map
<
std
::
string
,
size_t
>*
ply_names
(
new
std
::
map
<
std
::
string
,
size_t
>
);
...
...
@@ -669,8 +668,7 @@ void writeAllDataToGLIFileV4 (const std::string& fname, const GeoLib::GEOObjects
geo
.
getGeometryNames
(
geo_names
);
// extract path for reading external files
std
::
string
path
;
BaseLib
::
extractPath
(
fname
,
path
);
const
std
::
string
path
=
BaseLib
::
extractPath
(
fname
);
std
::
ofstream
os
(
fname
.
c_str
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment