Skip to content

Commit

Permalink
use unix path format in io primitives
Browse files Browse the repository at this point in the history
  • Loading branch information
cipher1024 committed May 19, 2019
1 parent ae55905 commit 464524a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/library/vm/vm_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace lean {
MK_THREAD_LOCAL_GET(std::string, local_cwd, lgetcwd())

std::string abspath(std::string const & path) {
return normalize_path( (sstream() << local_cwd() << "/" << path).str() );
return (sstream() << local_cwd() << "/" << to_unix_path(path)).str();
}

optional<std::string> local_realpath(std::string const & path) {
Expand Down
8 changes: 8 additions & 0 deletions src/util/path.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,14 @@ std::string normalize_path(std::string f) {
return f;
}

std::string to_unix_path(std::string f) {
for (auto & c : f) {
if (c == '\\')
c = '/';
}
return f;
}

std::string get_path(std::string f) {
while (true) {
if (f.empty())
Expand Down
2 changes: 2 additions & 0 deletions src/util/path.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ bool is_path_sep(char c);

std::string normalize_path(std::string f);

std::string to_unix_path(std::string f);

/** \brief Find all files with the given extension recursively. */
void find_files(std::string const & base, char const * ext, std::vector<std::string> & files);
bool has_file_ext(std::string const & fname, char const * ext);
Expand Down

0 comments on commit 464524a

Please sign in to comment.