Commit 7094e35f authored by Lefebvre, Jordan P's avatar Lefebvre, Jordan P

Merge branch 'get_paths' into 'master'

Small edit to get_path for Windows support.

See merge request !82
parents 602e27fe d9a5c880
Pipeline #67250 passed with stages
in 17 minutes and 13 seconds
......@@ -267,7 +267,9 @@ bool get_paths(const std::string &spec, std::vector<std::string> &paths,
// only return non-empty paths
for (const auto &p : return_paths)
{
if (p != "") paths.push_back(p);
// remove windows carriage return
std::string path = radix::find_and_replace(p, "\r", "");
if (path.compare("") != 0) paths.push_back(path);
}
// if we got nothing then return the original spec
......@@ -280,15 +282,17 @@ bool get_paths(const std::string &spec, std::vector<std::string> &paths,
// Windows dir /B always returns only the filenames
// we must manually prepend any preceeding filepath to return the same spec
// as 'ls -1'
std::string native_dir = radix::dirname(spec);
std::string native_dir = (radix::dir_exists(spec)) ? spec : radix::dirname(spec);
if (native_dir.compare(".") != 0)
{
for (size_t i = 0; i < paths.size(); ++i)
{
paths[i] = native_dir + "\\" + paths[i];
radix_tagged_line("Concatenating: " << native_dir << " and " << paths[i]);
paths[i] = native_dir + paths[i];
}
}
#endif
return true;
} // getPaths
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment