Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Brad King
CMake
Commits
dadf1570
Commit
dadf1570
authored
Apr 13, 2017
by
Brad King
Browse files
file: Refactor COPY/INSTALL relative path handling
Delay conversion to absolute path until the last moment.
parent
e155fba6
Pipeline
#54843
passed with stage
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Source/cmFileCommand.cxx
View file @
dadf1570
...
...
@@ -1314,13 +1314,7 @@ bool cmFileCopier::CheckValue(std::string const& arg)
{
switch
(
this
->
Doing
)
{
case
DoingFiles
:
if
(
arg
.
empty
()
||
cmSystemTools
::
FileIsFullPath
(
arg
.
c_str
()))
{
this
->
Files
.
push_back
(
arg
);
}
else
{
std
::
string
file
=
this
->
Makefile
->
GetCurrentSourceDirectory
();
file
+=
"/"
+
arg
;
this
->
Files
.
push_back
(
file
);
}
this
->
Files
.
push_back
(
arg
);
break
;
case
DoingDestination
:
if
(
arg
.
empty
()
||
cmSystemTools
::
FileIsFullPath
(
arg
.
c_str
()))
{
...
...
@@ -1390,11 +1384,20 @@ bool cmFileCopier::Run(std::vector<std::string> const& args)
return
false
;
}
std
::
vector
<
std
::
string
>
const
&
files
=
this
->
Files
;
for
(
std
::
vector
<
std
::
string
>::
size_type
i
=
0
;
i
<
files
.
size
();
++
i
)
{
for
(
std
::
vector
<
std
::
string
>::
const_iterator
i
=
this
->
Files
.
begin
();
i
!=
this
->
Files
.
end
();
++
i
)
{
std
::
string
file
;
if
(
!
i
->
empty
()
&&
!
cmSystemTools
::
FileIsFullPath
(
*
i
))
{
file
=
this
->
Makefile
->
GetCurrentSourceDirectory
();
file
+=
"/"
;
file
+=
*
i
;
}
else
{
file
=
*
i
;
}
// Split the input file into its directory and name components.
std
::
vector
<
std
::
string
>
fromPathComponents
;
cmSystemTools
::
SplitPath
(
file
s
[
i
]
,
fromPathComponents
);
cmSystemTools
::
SplitPath
(
file
,
fromPathComponents
);
std
::
string
fromName
=
*
(
fromPathComponents
.
end
()
-
1
);
std
::
string
fromDir
=
cmSystemTools
::
JoinPath
(
fromPathComponents
.
begin
(),
fromPathComponents
.
end
()
-
1
);
...
...
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