diff options
author | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-06-20 19:21:48 +0200 |
---|---|---|
committer | Bent Bisballe Nyeng <deva@aasimon.org> | 2018-08-12 11:11:45 +0200 |
commit | 6adb14a7027c8d54827093c83fc80694d71fb6a7 (patch) | |
tree | cc02ac1bdb548b0b317999d727a12fa5a9973594 /src/path.cc | |
parent | 1560674582102cd83197dccc79cb029fc843a48e (diff) |
Fix missing finalization of instruments on load. Fix relative instrument filenames according to the drumkit file. Make drumkit creator create version 2.0 drumkits. Reduce missing refs file to a warning.
Diffstat (limited to 'src/path.cc')
-rw-r--r-- | src/path.cc | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/path.cc b/src/path.cc index c2e7910..993f9a6 100644 --- a/src/path.cc +++ b/src/path.cc @@ -40,7 +40,7 @@ std::string getPath(const std::string& file) #ifdef __MINGW32__ char drive[_MAX_DRIVE]; char dir[_MAX_DIR]; - _splitpath(file.c_str(), drive, dir, NULL, NULL); + _splitpath(file.c_str(), drive, dir, nullptr, nullptr); path = std::string(drive) + dir; #else // POSIX @@ -51,3 +51,22 @@ std::string getPath(const std::string& file) return path; } + +std::string getFile(const std::string& file) +{ + std::string path; + +#ifdef __MINGW32__ + char fname[_MAX_FNAME]; + char ext[_MAX_EXT]; + _splitpath(file.c_str(), nullptr, nullptr, fname, ext); + path = std::string(fname) + "." + ext; +#else + // POSIX + char* buffer = strdup(file.c_str()); + path = basename(buffer); + free(buffer); +#endif + + return path; +} |