Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pedi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
Open Source Software
pedi
Commits
5008cbd8
"README.txt" did not exist on "d018a6a3b3c67add1485c92036b9910e5c04dd85"
Commit
5008cbd8
authored
6 years ago
by
Jason Hiser
Browse files
Options
Downloads
Patches
Plain Diff
create install directory if not already exists
parent
d4f06f29
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pedi.cpp
+33
-15
33 additions, 15 deletions
pedi.cpp
with
33 additions
and
15 deletions
pedi.cpp
+
33
−
15
View file @
5008cbd8
...
...
@@ -17,6 +17,33 @@
using
namespace
std
;
int
mkpath
(
const
string
&
path
,
const
mode_t
&
mode
)
{
auto
s
=
path
;
auto
pos
=
(
size_t
)
0
;
if
(
s
[
s
.
size
()
-
1
]
!=
'/'
)
{
// force trailing / so we can handle everything in loop
s
+=
'/'
;
}
// Caution! side effect in the while loop!
while
((
pos
=
s
.
find_first_of
(
'/'
,
pos
))
!=
string
::
npos
)
{
auto
dir
=
s
.
substr
(
0
,
pos
++
);
if
(
dir
.
size
()
==
0
)
continue
;
// if leading / first time is 0 length
auto
mdret
=
mkdir
(
dir
.
c_str
(),
mode
);
if
(
mdret
!=
0
&&
errno
!=
EEXIST
)
{
return
mdret
;
}
}
return
0
;
}
// Parse some options for the transform
static
struct
option
long_options
[]
=
{
{
"setup"
,
no_argument
,
0
,
's'
},
...
...
@@ -516,21 +543,6 @@ void read_configs()
auto
orig_configfile
=
trimmed
(
mf
)
+
".config"
;
read_config
(
orig_configfile
,
my_options
.
install_dir
,
my_options
.
labels
);
#if 0
for(const auto & s : manifest_files)
{
string install_dir, labels;
auto configfile=trimmed(s)+".config";
read_config(configfile, install_dir, labels);
if(my_options.install_dir != install_dir || my_options.labels != labels)
{
cerr<<"Mismatch configuration in "<<orig_configfile<<" and "<<configfile<<endl;
exit(1);
}
}
#endif
}
auto
previously_had_pedi_root
=
false
;
...
...
@@ -640,6 +652,12 @@ void finish()
{
if
(
!
configs_read
||
previously_had_pedi_root
)
{
auto
mkpath_err
=
mkpath
(
my_options
.
install_dir
,
S_IRUSR
|
S_IWUSR
|
S_IXUSR
);
if
(
mkpath_err
!=
0
)
{
cout
<<
" Could not make directory "
<<
my_options
.
install_dir
<<
endl
;
exit
(
1
);
}
ofstream
o
(
my_options
.
install_dir
+
"/"
+
".pedi_root"
);
if
(
my_options
.
verbose
)
cout
<<
"Writing pedi_root file."
<<
endl
;
...
...
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