mirror of https://gitlab.com/basile.b/dexed.git
fix #473 - sudo setup and ownership of the folder containing the settings
This commit is contained in:
parent
9b7c2bc01e
commit
fea5f7e4ce
|
@ -100,7 +100,7 @@ struct Formater
|
||||||
}
|
}
|
||||||
|
|
||||||
static immutable string exePath, datPath, shortCutPath;
|
static immutable string exePath, datPath, shortCutPath;
|
||||||
version(linux) immutable bool asSu;
|
version(linux) immutable string asSu;
|
||||||
|
|
||||||
static this()
|
static this()
|
||||||
{
|
{
|
||||||
|
@ -112,7 +112,7 @@ static this()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
asSu = environment.get("SUDO_USER") != "";
|
asSu = environment.get("SUDO_USER");
|
||||||
if (asSu)
|
if (asSu)
|
||||||
{
|
{
|
||||||
exePath = "/usr/bin/";
|
exePath = "/usr/bin/";
|
||||||
|
@ -333,7 +333,11 @@ bool installResource(ref ResType resource)
|
||||||
const string fname = resource.targetFilename;
|
const string fname = resource.targetFilename;
|
||||||
const string path = fname.dirName;
|
const string path = fname.dirName;
|
||||||
if (!path.exists)
|
if (!path.exists)
|
||||||
|
{
|
||||||
mkdirRecurse(path);
|
mkdirRecurse(path);
|
||||||
|
version(linux) if (asSu && resource.kind != Kind.exe)
|
||||||
|
executeShell("chown " ~ asSu ~ " " ~ path);
|
||||||
|
}
|
||||||
if (!path.exists)
|
if (!path.exists)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -343,8 +347,13 @@ bool installResource(ref ResType resource)
|
||||||
f.rawWrite(resource.data);
|
f.rawWrite(resource.data);
|
||||||
f.close;
|
f.close;
|
||||||
|
|
||||||
version(linux) if (resource.kind == Kind.exe && fname.exists)
|
version(linux)
|
||||||
|
{
|
||||||
|
if (resource.kind == Kind.exe && fname.exists)
|
||||||
executeShell("chmod a+x " ~ fname);
|
executeShell("chmod a+x " ~ fname);
|
||||||
|
else if (fname.exists && asSu)
|
||||||
|
executeShell("chown " ~ asSu ~ " " ~ fname);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue