mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 13:22:28 +02:00
Remove unnecessary file existence check in GMenu2X::writeSkinConfig
mkdir is able to return an error code in errno to indicate that the directory requested to be created already exists (EEXIST).
This commit is contained in:
parent
8cd3ab8cb8
commit
a60a529de6
@ -508,11 +508,15 @@ void GMenu2X::writeConfig() {
|
|||||||
|
|
||||||
void GMenu2X::writeSkinConfig() {
|
void GMenu2X::writeSkinConfig() {
|
||||||
string conffile = getHome() + "/skins/";
|
string conffile = getHome() + "/skins/";
|
||||||
if (!fileExists(conffile))
|
if (mkdir(conffile.c_str(), 0770) < 0 && errno != EEXIST) {
|
||||||
mkdir(conffile.c_str(), 0770);
|
ERROR("Failed to create directory %s to write skin configuration: %s\n", conffile.c_str(), strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
conffile = conffile + confStr["skin"];
|
conffile = conffile + confStr["skin"];
|
||||||
if (!fileExists(conffile))
|
if (mkdir(conffile.c_str(), 0770) < 0 && errno != EEXIST) {
|
||||||
mkdir(conffile.c_str(), 0770);
|
ERROR("Failed to create directory %s to write skin configuration: %s\n", conffile.c_str(), strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
conffile = conffile + "/skin.conf";
|
conffile = conffile + "/skin.conf";
|
||||||
|
|
||||||
ofstream inf(conffile.c_str());
|
ofstream inf(conffile.c_str());
|
||||||
|
Loading…
Reference in New Issue
Block a user