forked from markus/S_New4
fix erplaceing errno
This commit is contained in:
parent
98d8adfdfe
commit
66b3d9b08f
@ -8,21 +8,26 @@ int setPaths(Settings &settings)
|
|||||||
#ifdef linux
|
#ifdef linux
|
||||||
CacheDir = std::string(getenv("HOME")) + "/.cache/S_New4/";
|
CacheDir = std::string(getenv("HOME")) + "/.cache/S_New4/";
|
||||||
SettingsDir = std::string( getenv("HOME") ) + "/.config/S_New4/";
|
SettingsDir = std::string( getenv("HOME") ) + "/.config/S_New4/";
|
||||||
|
settings.pathSymbol = '/';
|
||||||
#endif
|
#endif
|
||||||
#ifdef __WIN32
|
#ifdef __WIN32
|
||||||
CacheDir = std::string(getenv("AppData")) + "\\Local\\S_New4\\";
|
CacheDir = std::string(getenv("AppData")) + "\\Local\\S_New4\\";
|
||||||
SettingsDir = std::string( getenv("AppData") ) + "\\Roaming\\S_New4\\";
|
SettingsDir = std::string( getenv("AppData") ) + "\\Roaming\\S_New4\\";
|
||||||
|
settings.pathSymbol = '\\';
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if(!dirExists(CacheDir)) {
|
if(CacheDir == "" || SettingsDir == "") {
|
||||||
|
std::cout << " => Error: PfadVariablen sind nicht gesetzt." << std::endl;
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
} else if(!dirExists(CacheDir)) {
|
||||||
if(!createDirIsOk(CacheDir)) {
|
if(!createDirIsOk(CacheDir)) {
|
||||||
std::cout << " => Error: Konnte Ordner nicht erstellen: " << CacheDir << std::endl;
|
std::cout << " => Error: Konnte Ordner nicht erstellen: " << CacheDir << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
} else
|
} else
|
||||||
std::cout << " => Erfolgreich Ordner '" << CacheDir << "' erstellt." << std::endl;
|
std::cout << " => Erfolgreich Ordner '" << CacheDir << "' erstellt." << std::endl;
|
||||||
|
|
||||||
}
|
} if(!dirExists(SettingsDir)) {
|
||||||
if(!dirExists(SettingsDir)) {
|
|
||||||
if(!createDirIsOk(SettingsDir)) {
|
if(!createDirIsOk(SettingsDir)) {
|
||||||
std::cout << " => Error: Konnte Ordner nicht erstellen: " << SettingsDir << std::endl;
|
std::cout << " => Error: Konnte Ordner nicht erstellen: " << SettingsDir << std::endl;
|
||||||
return -1;
|
return -1;
|
||||||
@ -43,7 +48,6 @@ int setPaths(Settings &settings)
|
|||||||
int manageParameter(Settings &settings, int argc, char **argv)
|
int manageParameter(Settings &settings, int argc, char **argv)
|
||||||
{
|
{
|
||||||
//Path settings
|
//Path settings
|
||||||
setPathSymbol(settings);
|
|
||||||
if(setPaths(settings) != 0)
|
if(setPaths(settings) != 0)
|
||||||
return -1;
|
return -1;
|
||||||
if(loadDefaulOptions(settings) != 0)
|
if(loadDefaulOptions(settings) != 0)
|
||||||
@ -873,7 +877,7 @@ void unterOption_clean(Settings * settings, int argc, char **argv)
|
|||||||
|
|
||||||
for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + std::to_string(i)); i++) {
|
for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + std::to_string(i)); i++) {
|
||||||
if(remove( (settings->cookieFilePath + std::to_string(i)).c_str() ) != 0) {
|
if(remove( (settings->cookieFilePath + std::to_string(i)).c_str() ) != 0) {
|
||||||
std::cout << " => Error: Das löschen von " << settings->cookieFilePath + std::to_string(i) << " ist fehlgeschlagen: " << errno << std::endl;
|
perror((" => Error: Das löschen von " + settings->cookieFilePath + std::to_string(i) + " ist fehlgeschlagen: ").c_str());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
count++;
|
count++;
|
||||||
@ -934,16 +938,6 @@ std::string getexepath()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void setPathSymbol(Settings &settings)
|
|
||||||
{
|
|
||||||
#ifdef linux
|
|
||||||
settings.pathSymbol = '/';
|
|
||||||
#endif
|
|
||||||
#ifdef _WIN32
|
|
||||||
settings.pathSymbol = '\\';
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
bool fileExists (const std::string& name) {
|
bool fileExists (const std::string& name) {
|
||||||
struct stat buffer;
|
struct stat buffer;
|
||||||
return (stat (name.c_str(), &buffer) == 0 && S_ISREG(buffer.st_mode));
|
return (stat (name.c_str(), &buffer) == 0 && S_ISREG(buffer.st_mode));
|
||||||
|
@ -69,7 +69,6 @@ bool isNumber(std::string number);
|
|||||||
std::string getProgramName();
|
std::string getProgramName();
|
||||||
std::string getexepath();
|
std::string getexepath();
|
||||||
|
|
||||||
void setPathSymbol(Settings &settings);
|
|
||||||
int setPaths(Settings &settings);
|
int setPaths(Settings &settings);
|
||||||
|
|
||||||
bool fileExists (const std::string& name);
|
bool fileExists (const std::string& name);
|
||||||
|
Loading…
Reference in New Issue
Block a user