mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Removed --home-path argument.
I forgot, for weeks on end, that you can just manipulate environment variables.
This commit is contained in:
parent
bbd58a22d0
commit
b85876339b
|
@ -109,7 +109,6 @@ You can use `--help` or `-h` to view a list of command-line options. Briefly out
|
||||||
--debug - print additional output to the console, primarily about input.
|
--debug - print additional output to the console, primarily about input.
|
||||||
--windowed - run ES in a window, works best in conjunction with --resolution [w] [h].
|
--windowed - run ES in a window, works best in conjunction with --resolution [w] [h].
|
||||||
--scrape - run the interactive command-line metadata scraper.
|
--scrape - run the interactive command-line metadata scraper.
|
||||||
--home-path [path] - use [path] instead of the "home" environment variable (useful for portable installations).
|
|
||||||
```
|
```
|
||||||
|
|
||||||
As long as ES hasn't frozen, you can always press F4 to close the application.
|
As long as ES hasn't frozen, you can always press F4 to close the application.
|
||||||
|
|
|
@ -34,6 +34,4 @@ private:
|
||||||
std::map<std::string, int> mIntMap;
|
std::map<std::string, int> mIntMap;
|
||||||
std::map<std::string, float> mFloatMap;
|
std::map<std::string, float> mFloatMap;
|
||||||
std::map<std::string, std::string> mStringMap;
|
std::map<std::string, std::string> mStringMap;
|
||||||
|
|
||||||
std::string mHomePathOverride;
|
|
||||||
};
|
};
|
||||||
|
|
24
src/main.cpp
24
src/main.cpp
|
@ -23,26 +23,6 @@ namespace fs = boost::filesystem;
|
||||||
|
|
||||||
bool scrape_cmdline = false;
|
bool scrape_cmdline = false;
|
||||||
|
|
||||||
// we do this separately from the other args because the other args might call Settings::getInstance()
|
|
||||||
// which will load the file getHomePath() + "/.emulationstation/es_settings.cfg", and getHomePath() needs to be accurate by then
|
|
||||||
bool parseArgsForHomeDir(int argc, char* argv[])
|
|
||||||
{
|
|
||||||
for(int i = 1; i < argc; i++)
|
|
||||||
{
|
|
||||||
if(strcmp(argv[i], "--home-path") == 0)
|
|
||||||
{
|
|
||||||
if(i >= argc - 1)
|
|
||||||
{
|
|
||||||
std::cerr << "No home path specified!\n";
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
setHomePathOverride(argv[i + 1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height)
|
bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height)
|
||||||
{
|
{
|
||||||
for(int i = 1; i < argc; i++)
|
for(int i = 1; i < argc; i++)
|
||||||
|
@ -93,7 +73,6 @@ bool parseArgs(int argc, char* argv[], unsigned int* width, unsigned int* height
|
||||||
std::cout << "--debug even more logging\n";
|
std::cout << "--debug even more logging\n";
|
||||||
std::cout << "--scrape scrape using command line interface\n";
|
std::cout << "--scrape scrape using command line interface\n";
|
||||||
std::cout << "--windowed not fullscreen, should be used in conjunction with --resolution\n";
|
std::cout << "--windowed not fullscreen, should be used in conjunction with --resolution\n";
|
||||||
std::cout << "--home-path [path] use [path] instead of the \"home\" environment variable (for portable installations)\n";
|
|
||||||
std::cout << "--help, -h summon a sentient, angry tuba\n\n";
|
std::cout << "--help, -h summon a sentient, angry tuba\n\n";
|
||||||
std::cout << "More information available in README.md.\n";
|
std::cout << "More information available in README.md.\n";
|
||||||
return false; //exit after printing help
|
return false; //exit after printing help
|
||||||
|
@ -159,9 +138,6 @@ int main(int argc, char* argv[])
|
||||||
unsigned int width = 0;
|
unsigned int width = 0;
|
||||||
unsigned int height = 0;
|
unsigned int height = 0;
|
||||||
|
|
||||||
if(!parseArgsForHomeDir(argc, argv)) // returns false if an invalid path was specified
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
if(!parseArgs(argc, argv, &width, &height))
|
if(!parseArgs(argc, argv, &width, &height))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
|
@ -3,21 +3,8 @@
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
std::string sHomePathOverride;
|
|
||||||
|
|
||||||
void setHomePathOverride(const std::string& path)
|
|
||||||
{
|
|
||||||
// make it use generic directory separators
|
|
||||||
sHomePathOverride = boost::filesystem::path(path).generic_string();
|
|
||||||
|
|
||||||
std::cout << "Using home path: " << sHomePathOverride;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string getHomePath()
|
std::string getHomePath()
|
||||||
{
|
{
|
||||||
if(!sHomePathOverride.empty())
|
|
||||||
return sHomePathOverride;
|
|
||||||
|
|
||||||
std::string homePath;
|
std::string homePath;
|
||||||
|
|
||||||
// this should give you something like "/home/YOUR_USERNAME" on Linux and "C:\Users\YOUR_USERNAME\" on Windows
|
// this should give you something like "/home/YOUR_USERNAME" on Linux and "C:\Users\YOUR_USERNAME\" on Windows
|
||||||
|
@ -28,7 +15,7 @@ std::string getHomePath()
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
// but does not seem to work for Windwos XP or Vista, so try something else
|
// but does not seem to work for Windows XP or Vista, so try something else
|
||||||
if (homePath.empty()) {
|
if (homePath.empty()) {
|
||||||
const char * envDir = getenv("HOMEDRIVE");
|
const char * envDir = getenv("HOMEDRIVE");
|
||||||
const char * envPath = getenv("HOMEPATH");
|
const char * envPath = getenv("HOMEPATH");
|
||||||
|
|
Loading…
Reference in a new issue