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
Snippets
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
Dmitri Naumov
ogs
Commits
8bbd72e1
Commit
8bbd72e1
authored
3 years ago
by
Lars Bilke
Committed by
Dmitri Naumov
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[ogs] Fix xml includes in combination with patches
parent
6cc1fea9
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Applications/CLI/ogs.cpp
+7
-2
7 additions, 2 deletions
Applications/CLI/ogs.cpp
BaseLib/ConfigTreeUtil.cpp
+7
-2
7 additions, 2 deletions
BaseLib/ConfigTreeUtil.cpp
BaseLib/ConfigTreeUtil.h
+2
-1
2 additions, 1 deletion
BaseLib/ConfigTreeUtil.h
with
16 additions
and
5 deletions
Applications/CLI/ogs.cpp
+
7
−
2
View file @
8bbd72e1
...
@@ -45,6 +45,7 @@
...
@@ -45,6 +45,7 @@
#include
"InfoLib/GitInfo.h"
#include
"InfoLib/GitInfo.h"
#include
"NumLib/NumericsConfig.h"
#include
"NumLib/NumericsConfig.h"
#include
"ProcessLib/TimeLoop.h"
#include
"ProcessLib/TimeLoop.h"
#include
"filesystem.h"
#ifdef OGS_USE_PYTHON
#ifdef OGS_USE_PYTHON
#include
"ogs_embedded_python.h"
#include
"ogs_embedded_python.h"
...
@@ -193,6 +194,7 @@ int main(int argc, char* argv[])
...
@@ -193,6 +194,7 @@ int main(int argc, char* argv[])
std
::
string
prj_file
=
project_arg
.
getValue
();
std
::
string
prj_file
=
project_arg
.
getValue
();
auto
patch_files
=
xml_patch_files
.
getValue
();
auto
patch_files
=
xml_patch_files
.
getValue
();
std
::
string
includepath
=
""
;
if
(
BaseLib
::
getFileExtension
(
prj_file
)
==
".xml"
)
if
(
BaseLib
::
getFileExtension
(
prj_file
)
==
".xml"
)
{
{
if
(
!
patch_files
.
empty
())
if
(
!
patch_files
.
empty
())
...
@@ -223,6 +225,8 @@ int main(int argc, char* argv[])
...
@@ -223,6 +225,8 @@ int main(int argc, char* argv[])
if
(
!
patch_files
.
empty
())
if
(
!
patch_files
.
empty
())
{
{
includepath
=
fs
::
canonical
(
fs
::
path
(
prj_file
)).
parent_path
().
string
();
std
::
string
current_prj_file
=
prj_file
;
std
::
string
current_prj_file
=
prj_file
;
std
::
string
current_prj_file_base
=
std
::
string
current_prj_file_base
=
BaseLib
::
extractBaseNameWithoutExtension
(
current_prj_file
);
BaseLib
::
extractBaseNameWithoutExtension
(
current_prj_file
);
...
@@ -290,8 +294,9 @@ int main(int argc, char* argv[])
...
@@ -290,8 +294,9 @@ int main(int argc, char* argv[])
prj_file
=
project_arg
.
getValue
();
prj_file
=
project_arg
.
getValue
();
}
}
auto
project_config
=
BaseLib
::
makeConfigTree
(
auto
project_config
=
prj_file
,
!
nonfatal_arg
.
getValue
(),
"OpenGeoSysProject"
);
BaseLib
::
makeConfigTree
(
prj_file
,
!
nonfatal_arg
.
getValue
(),
"OpenGeoSysProject"
,
includepath
);
BaseLib
::
setProjectDirectory
(
BaseLib
::
setProjectDirectory
(
BaseLib
::
extractPath
(
project_arg
.
getValue
()));
BaseLib
::
extractPath
(
project_arg
.
getValue
()));
...
...
This diff is collapsed.
Click to expand it.
BaseLib/ConfigTreeUtil.cpp
+
7
−
2
View file @
8bbd72e1
...
@@ -111,7 +111,8 @@ void replace_includes(
...
@@ -111,7 +111,8 @@ void replace_includes(
ConfigTreeTopLevel
makeConfigTree
(
const
std
::
string
&
filepath
,
ConfigTreeTopLevel
makeConfigTree
(
const
std
::
string
&
filepath
,
const
bool
be_ruthless
,
const
bool
be_ruthless
,
const
std
::
string
&
toplevel_tag
)
const
std
::
string
&
toplevel_tag
,
std
::
string
includepath
)
{
{
ConfigTree
::
PTree
ptree
;
ConfigTree
::
PTree
ptree
;
...
@@ -125,7 +126,11 @@ ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
...
@@ -125,7 +126,11 @@ ConfigTreeTopLevel makeConfigTree(const std::string& filepath,
if
(
toplevel_tag
==
"OpenGeoSysProject"
)
if
(
toplevel_tag
==
"OpenGeoSysProject"
)
{
{
traverse
(
ptree
,
fs
::
path
(
filepath
).
parent_path
(),
replace_includes
);
if
(
includepath
==
""
)
{
includepath
=
fs
::
path
(
filepath
).
parent_path
().
string
();
}
traverse
(
ptree
,
fs
::
path
(
includepath
),
replace_includes
);
}
}
}
}
catch
(
boost
::
property_tree
::
xml_parser_error
const
&
e
)
catch
(
boost
::
property_tree
::
xml_parser_error
const
&
e
)
...
...
This diff is collapsed.
Click to expand it.
BaseLib/ConfigTreeUtil.h
+
2
−
1
View file @
8bbd72e1
...
@@ -69,6 +69,7 @@ private:
...
@@ -69,6 +69,7 @@ private:
* \param be_ruthless see ConfigTreeTopLevel::ConfigTreeTopLevel()
* \param be_ruthless see ConfigTreeTopLevel::ConfigTreeTopLevel()
* \param toplevel_tag name of the outermost tag in the XML file. The returned ConfigTree is rooted
* \param toplevel_tag name of the outermost tag in the XML file. The returned ConfigTree is rooted
* one level below that tag.
* one level below that tag.
* \param includepath optional path in which relative include file path will be resolved.
*
*
* The parameter \c toplevel_tag is provided for compatibility with our existing configuration
* The parameter \c toplevel_tag is provided for compatibility with our existing configuration
* files whose toplevel tags are written in camel case, which conflicts with the naming rules of
* files whose toplevel tags are written in camel case, which conflicts with the naming rules of
...
@@ -87,6 +88,6 @@ private:
...
@@ -87,6 +88,6 @@ private:
*/
*/
ConfigTreeTopLevel
ConfigTreeTopLevel
makeConfigTree
(
std
::
string
const
&
filepath
,
bool
const
be_ruthless
,
makeConfigTree
(
std
::
string
const
&
filepath
,
bool
const
be_ruthless
,
std
::
string
const
&
toplevel_tag
);
std
::
string
const
&
toplevel_tag
,
std
::
string
includepath
=
""
);
}
// namespace BaseLib
}
// namespace BaseLib
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