Added Windows compiled files to .gitignore.

Added "WIN32" preprocessor definition to the default VS2010 project.
Replaced getHomePath() with the one mentioned in the pull request comments.
This commit is contained in:
Aloshi 2013-05-16 12:43:16 -05:00
parent 8803266660
commit 0f6338045a
3 changed files with 32 additions and 10 deletions

6
.gitignore vendored
View file

@ -11,11 +11,17 @@
*.la *.la
*.a *.a
# And on Windows
*.dll
*.pdb
*.exe.manifest
# Dependency makefiles # Dependency makefiles
*.d *.d
#Compiled executable #Compiled executable
emulationstation emulationstation
emulationstation.exe
#build directory #build directory
EmulationStation_vs2010 EmulationStation_vs2010

View file

@ -3,12 +3,12 @@
<ImportGroup Label="PropertySheets" /> <ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" /> <PropertyGroup Label="UserMacros" />
<PropertyGroup> <PropertyGroup>
<IncludePath>$(IncludePath)</IncludePath> <IncludePath>$(IncludePath)</IncludePath>
<LibraryPath>$(LibraryPath)</LibraryPath> <LibraryPath>$(LibraryPath)</LibraryPath>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup> <ItemDefinitionGroup>
<ClCompile> <ClCompile>
<PreprocessorDefinitions>_DESKTOP_;%(PreprocessorDefinitions)</PreprocessorDefinitions> <PreprocessorDefinitions>_DESKTOP_;WIN32;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile> </ClCompile>
<Link> <Link>
<AdditionalDependencies>SDLmain.lib;SDL.lib;FreeImage.lib;freetype.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies> <AdditionalDependencies>SDLmain.lib;SDL.lib;FreeImage.lib;freetype.lib;opengl32.lib;%(AdditionalDependencies)</AdditionalDependencies>

View file

@ -3,10 +3,26 @@
std::string getHomePath() std::string getHomePath()
{ {
//this gives you something like "/home/YOUR_USERNAME" on Linux and "C:\Users\YOUR_USERNAME\" on Windows std::string homePath;
const char* home = getenv("HOME"); //this should give you something like "/home/YOUR_USERNAME" on Linux and "C:\Users\YOUR_USERNAME\" on Windows
if(home == NULL) const char * envHome = getenv("HOME");
return ""; if(envHome != nullptr) {
else homePath = envHome;
return home; }
#ifdef WIN32
//but does not seem to work for Windwos XP or Vista, so try something else
if (homePath.empty()) {
const char * envDir = getenv("HOMEDRIVE");
const char * envPath = getenv("HOMEPATH");
if (envDir != nullptr && envPath != nullptr) {
homePath = envDir;
homePath += envPath;
}
}
#else
if (homePath.empty()) {
homePath = "~";
}
#endif
return homePath;
} }