Skip to content

Commit

Permalink
Utility function for path to data directory
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.code.sf.net/p/fuego/code/trunk@2015 2e953b5c-c64d-0410-be54-f773e93e544c
  • Loading branch information
mmueller65 committed Oct 2, 2015
1 parent 4de7e28 commit 9f17c2d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions smartgame/SgPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <sys/sysctl.h>
#endif

#include "SgStringUtil.h"
//----------------------------------------------------------------------------
/** The program directory. Used for finding data files */
boost::filesystem::path s_programDir;
Expand Down Expand Up @@ -51,6 +52,13 @@ void SgPlatform::SetTopSourceDir(const boost::filesystem::path& dir)
s_topSourceDir = dir;
}

std::string SgPlatform::GetDataFileNativePath(const std::string& filename)
{
const boost::filesystem::path& filePath = SgPlatform::GetTopSourceDir()
/ "data" / filename;
return SgStringUtil::GetNativeFileName(filePath);
}

//----------------------------------------------------------------------------

std::size_t SgPlatform::TotalMemory()
Expand Down
3 changes: 3 additions & 0 deletions smartgame/SgPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
/** Get information about the current computer. */
namespace SgPlatform
{
/** Get native path for a file in fuego/data directory */
std::string GetDataFileNativePath(const std::string& filename);

/** @see SetProgramDir */
const boost::filesystem::path& GetProgramDir();

Expand Down

0 comments on commit 9f17c2d

Please sign in to comment.