Skip to content

Commit

Permalink
fs: Fix normalize_path("") incongruity with Boost.filesystem
Browse files Browse the repository at this point in the history
The non-BFS version of normalize_path() returns an empty string when
passed an empty string, but the BFS version returns the normalized
version of the current working dir for the Wesnoth process.

Due to the way editor::start()'s arguments are built from the process
command line, the result of normalize_path("") gets passed to it when
starting with the --editor switch and no map path argument. If the
result describes a directory, the editor brings up the filechooser
dialog on that path; otherwise, it attempts to open it as a map file.

Making the BFS version of normalize_path() follow the non-BFS behavior
fixes the editor unexpectedly bringing up the filechooser when started
from the command line.
  • Loading branch information
irydacea committed Nov 8, 2014
1 parent 40f73c8 commit a6073c8
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/filesystem_boost.cpp
Expand Up @@ -863,6 +863,10 @@ bool is_path_sep(char c)
}
std::string normalize_path(const std::string &fpath)
{
if (fpath.empty()) {
return fpath;
}

return bfs::absolute(fpath).string();
}

Expand Down

0 comments on commit a6073c8

Please sign in to comment.