void Updater::DO_Uninstall(void) { // removes executable String path; #ifdef PLATFORM_POSIX path = AppendFileName(GetProgramsFolder(), appName); #else path = AppendFileName(GetProgramsFolder(), appName + "/" + appName + ".exe"); #endif FileDelete(path); // removes system config folder // leaves user one alone, it can contain user data // (on win32, that's also the program folder) DeleteFolderDeep(systemConfigPath); // unlink application from shess ShellUnlink(); // signal op success and leave // as it was uninstalling, it will restart // launching app (uninstaller, possibily) SucceedUpdate(); RestartApp(RestartTemp); }
void Ide::ExportProject(const String& ep, bool all, bool gui, bool deletedir) { SaveFile(false); ::Workspace wspc; wspc.Scan(main); Index<String> used; HdependClearDependencies(); for(int i = 0; i < wspc.GetCount(); i++) { const Package& p = wspc.GetPackage(i); String pn = wspc[i]; for(int j = 0; j < p.GetCount(); j++) { const Package::File& f = p[j]; if(!f.separator) { String p = SourcePath(pn, f); used.FindAdd(p); Vector<String> d = HdependGetDependencies(p); for(int q = 0; q < d.GetCount(); q++) used.FindAdd(d[q]); for(int q = 0; q < f.depends.GetCount(); q++) used.FindAdd(SourcePath(pn, f.depends[q].text)); } } } if(FileExists(ep)) { if(gui && !PromptYesNo(DeQtf(ep) + " is existing file.&" "Do you want to delete it?")) return; FileDelete(ep); } if(deletedir && DirectoryExists(ep)) { if(gui && !PromptYesNo(DeQtf(ep) + " is existing directory.&" "Do you want to replace it?")) return; DeleteFolderDeep(ep); } Progress pi("Exporting project"); pi.SetTotal(wspc.GetCount()); for(int i = 0; i < wspc.GetCount(); i++) { if(gui && pi.StepCanceled()) return; CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true); } Vector<String> upp = GetUppDirs(); for(int i = 0; i < upp.GetCount(); i++) { if(gui && pi.StepCanceled()) return; String d = upp[i]; FindFile ff(AppendFileName(d, "*")); while(ff) { if(ff.IsFile()) { String fn = ff.GetName(); String path = AppendFileName(d, fn); if(all || used.Find(path) >= 0) CopyFile(AppendFileName(ep, fn), path, true); } ff.Next(); } CopyFolder(AppendFileName(ep, wspc[i]), PackageDirectory(wspc[i]), used, all, true); } ExportMakefile(ep); }
bool GatherTpp::MakeHtml(const char *folder, Gate2<int, int> progress) { DeleteFolderDeep(folder); DirectoryCreate(folder); for(int i = 0; i < tt.GetCount(); i++) { String topic = tt.GetKey(i); links.Add(topic, topic == indexTopic ? "index.html" : memcmp(topic, "topic://", 8) ? topic : TopicFileNameHtml(topic)); } for(int i = 0; i < reflink.GetCount(); i++) { String l = reflink.GetKey(i); String lbl = Filter(l, CharFilterLbl); String f = links.Get(reflink[i], Null) + '#' + lbl; links.Add(l, f); static const char *x[] = { "::struct", "::class", "::union" }; for(int ii = 0; ii < 3; ii++) { String e = x[ii]; if(EndsWith(l, e)) { links.Add(l.Mid(0, l.GetLength() - e.GetLength()), f); } } labels.Add(l, lbl); } for(int i = 0; i < tt.GetCount(); i++) { if (progress(i+1, tt.GetCount())) return false; ExportPage(i, folder); } return true; }
void Error(char *sz) { MessageBox(GetActiveWindow(), sz, "Ultimate++ installer", MB_ICONSTOP | MB_OK | MB_APPLMODAL); if(outdir) DeleteFolderDeep(outdir); exit(1); }
void Ide::CleanUppOut() { String out = GetVar("OUTPUT"); if(!PromptYesNo(NFormat("Erase the whole output directory [* \1%s\1]?", out))) return; console.Clear(); PutConsole("UPPOUT cleanup..."); DeleteFolderDeep(out); PutConsole("(done)"); HideBottom(); }
void WorkspaceWork::DelFile() { if(!filelist.IsCursor() || filelist[fileindex[filelist.GetCursor()]].isdir) return; String file = GetActiveFilePath(); if(IsFolder(file)) { if(!PromptYesNo("Remove the topic group and discard ALL topics?")) return; RemoveFile(); DeleteFolderDeep(file); } else { if(!PromptYesNo("Remove the file from package and discard it ?")) return; RemoveFile(); ::DeleteFile(file); } }
bool DeleteFolderDeep(const char *dir) { { FindFile ff(AppendFileName(dir, "*.*")); while(ff) { String name = ff.GetName(); String p = AppendFileName(dir, name); if(ff.IsFile()) FileDelete(p); else if(ff.IsFolder()) DeleteFolderDeep(p); ff.Next(); } } return DirectoryDelete(dir); }
void SelectPackageDlg::DeletePackage() { String n = GetCurrentName(); if(IsNull(n)) return; String pp = GetFileFolder(PackagePath(GetCurrentName())); if(!DirectoryExists(pp)) { Exclamation("Directory does not exist!"); return; } if(!PromptYesNo("Do you really want to delete package [* \1" + GetCurrentName() + "\1]?&&" "[/ Warning:] [* Package will not be removed " "from uses of any other package!]")) return; if(!PromptYesNo("This operation is irreversible.&Do you really want to proceed?")) return; DeleteFolderDeep(pp); Load(); }
void WorkspaceWork::DeletePackage() { String active = GetActivePackage(); if(package.GetCursor() == 0) { Exclamation("Cannot delete the main package!"); return; } if(IsAux() || !package.IsCursor() || !PromptYesNo("Do you really want to delete package [* \1" + active + "\1]?&&" "[/ Warning:] [* Package will only be removed&" "from packages of current workspace!]")) return; if(!PromptYesNo("This operation is irreversible.&Do you really want to proceed?")) return; if(!DeleteFolderDeep(GetFileFolder(GetActivePackagePath()))) { Exclamation("Deleting directory has failed."); return; } PackageOp(active, Null, Null); }
void CppBuilder::CleanPackage(const String& package, const String& outdir) { DeleteFolderDeep(outdir); }