cesetup, change version + minor tweaks

This commit is contained in:
Basile Burg 2015-06-08 16:54:39 +02:00
parent d0ec5886d5
commit b7b3e05d8f
1 changed files with 14 additions and 14 deletions

View File

@ -1,7 +1,7 @@
module cesetup; module cesetup;
import std.stdio: writeln, readln; import std.stdio;
import std.file: mkdir, exists, remove, rmdir, getSize; import std.file: mkdir, exists, remove, rmdir, getSize, FileException;
import std.stream: File, FileMode; import std.stream: File, FileMode;
import std.process: environment, executeShell; import std.process: environment, executeShell;
import std.path: dirSeparator; import std.path: dirSeparator;
@ -37,7 +37,7 @@ auto dcdlic = Resource(cast(ubyte[]) import("dcd.license.txt"), "dcd.license.tx
static string exePath, appDataPath, shortCutPath; static string exePath, appDataPath, shortCutPath;
static bool asSu; version(win32){} else immutable bool asSu;
static this() static this()
{ {
@ -45,7 +45,7 @@ static this()
{ {
exePath = environment.get("PROGRAMFILES") ~ r"\Coedit\"; exePath = environment.get("PROGRAMFILES") ~ r"\Coedit\";
appDataPath = environment.get("APPDATA") ~ r"\Coedit\"; appDataPath = environment.get("APPDATA") ~ r"\Coedit\";
shortCutPath = environment.get(r"USERPROFILE") ~ r"\Desktop\"; shortCutPath = environment.get("USERPROFILE") ~ r"\Desktop\";
} }
else else
{ {
@ -77,9 +77,9 @@ void main(string[] args)
writeln("|---------------------------------------------|"); writeln("|---------------------------------------------|");
if (!uninstall) if (!uninstall)
writeln("| Coedit 1.0 RC1 setup |"); writeln("| Coedit 1.0 setup |");
else else
writeln("| Coedit 1.0 RC1 uninstaller |"); writeln("| Coedit 1.0 uninstaller |");
writeln("|---------------------------------------------|"); writeln("|---------------------------------------------|");
version(win32) version(win32)
@ -161,8 +161,8 @@ void main(string[] args)
version(win32) version(win32)
{ {
try std.file.rmdir(exePath); try rmdir(exePath);
catch(Exception e) failures++; catch(FileException e) failures++;
} }
if (failures) if (failures)
@ -214,7 +214,7 @@ bool uninstallResource(Resource resource, string path)
string fname = path ~ dirSeparator ~ resource.destName; string fname = path ~ dirSeparator ~ resource.destName;
if (!fname.exists) return true; if (!fname.exists) return true;
try remove(fname); try remove(fname);
catch (Exception e) return false; catch (FileException e) return false;
return true; return true;
} }
@ -234,13 +234,13 @@ void nuxPostInstall()
void nuxPostUninstall() void nuxPostUninstall()
{ {
try remove(shortCutPath ~ "coedit.desktop"); try remove(shortCutPath ~ "coedit.desktop");
catch (Exception e) {} catch (FileException e) {}
} }
void win32PostInstall() void win32PostInstall()
{ {
// notice: this is not a true shortcut, other options are // notice: this is not a true shortcut, other options are
// - create a true lnk by generating a vbs // - create a true lnk by generating and executing a vbs
// - use winapi... // - use winapi...
string target = exePath ~ "coedit.exe"; string target = exePath ~ "coedit.exe";
File f = new File(shortCutPath ~ "Coedit.url", FileMode.OutNew); File f = new File(shortCutPath ~ "Coedit.url", FileMode.OutNew);
@ -256,5 +256,5 @@ void win32PostInstall()
void win32PostUninstall() void win32PostUninstall()
{ {
try remove(shortCutPath ~ "Coedit.url"); try remove(shortCutPath ~ "Coedit.url");
catch (Exception e) {} catch (FileException e) {}
} }