Skip to content

Commit

Permalink
Quick alternative to realpath, requires C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinPitrat committed Jan 26, 2025
1 parent 96f67ad commit 54a57a7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/gui/src/CapriceLoadSave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
#include <algorithm>

#ifdef WINDOWS
#define realpath(N,R) _fullpath((R),(N),_MAX_PATH)
#include <filesystem>

char *realpath(const char *path, char *resolved_path) {
auto fs_path = std::filesystem::path(path);
auto canonical = std::filesystem::canonical(fs_path);
strncpy(resolved_path, canonical.c_str(), _MAX_PATH);
}
#endif


Expand Down

0 comments on commit 54a57a7

Please sign in to comment.