Skip to content

Commit

Permalink
implemented getRealFilePath
Browse files Browse the repository at this point in the history
  • Loading branch information
jporsay committed Mar 21, 2013
1 parent 496c85d commit 104d40f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/game/fs/FS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ bool FS::mount(std::string folder, std::string location, bool absolutePath, bool
return PHYSFS_mount(folder.c_str(), location.c_str(), appendToSearchPath) != 0;
}

const std::string FS::getRealFilePath(std::string file) const {
const char* path = PHYSFS_getRealDir(file.c_str());
if (path == 0) {
return std::string();
}
return std::string(path).append(std::string(PHYSFS_getDirSeparator())).append(file);
}

File* FS::getFile(std::string filePath, FileMode mode) const {
File* f = new File(filePath, mode);
if (!f->init()) {
Expand Down
1 change: 1 addition & 0 deletions src/game/include/asteroids/fs/FS.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ class FS {
inline const char* getLastError() const { return PHYSFS_getLastError(); };
bool mount(std::string folder, std::string location, bool absolutePath = false, bool appendToSearchPath = true);
File* getFile(std::string filePath, FileMode mode) const;
const std::string getRealFilePath(std::string file) const;
void shutDown();
~FS();
};
Expand Down

0 comments on commit 104d40f

Please sign in to comment.