mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-02 14:22:23 -06:00
ide: Fixed clang-format in MacOS, upgrade theide function implemented for macos
This commit is contained in:
parent
74471235a2
commit
06b25db00a
5 changed files with 31 additions and 15 deletions
|
|
@ -100,9 +100,7 @@ void MakeBuild::CreateHost(Host& host, const String& method, bool darkmode, bool
|
|||
VectorMap<String, String> bm = GetMethodVars(method);
|
||||
{
|
||||
VectorMap<String, String> env = clone(Environment());
|
||||
DDUMP(env);
|
||||
host.exedirs = SplitDirs(bm.Get("PATH", "") + ';' + env.Get("PATH", ""));
|
||||
DDUMP(env.Get("PATH", ""));
|
||||
#ifdef PLATFORM_WIN32
|
||||
host.AddExecutable(GetExeDirFile("bin/mingit/cmd"), "git.exe");
|
||||
host.AddExecutable(GetExeDirFile("bin/llvm/bin"), "clang-format.exe");
|
||||
|
|
@ -649,7 +647,6 @@ int HostSys(const char *cmd, String& out)
|
|||
mb->CreateHost(host, false, false);
|
||||
LocalProcess p;
|
||||
host.canlog = false;
|
||||
DDUMP(cmd);
|
||||
if(host.StartProcess(p, cmd))
|
||||
return p.Finish(out);
|
||||
return Null;
|
||||
|
|
|
|||
|
|
@ -134,8 +134,6 @@ bool Host::StartProcess(LocalProcess& p, const char *cmdline)
|
|||
try {
|
||||
if(canlog) Log(cmdline);
|
||||
p.NoConvertCharset();
|
||||
DDUMP(exedirs);
|
||||
DDUMP(FindCommand(exedirs, cmdline));
|
||||
if(p.Start(FindCommand(exedirs, cmdline), environment))
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,6 @@ String ReformatCpp(CodeEditor& editor, bool setcursor, bool prefer_clang_format)
|
|||
|
||||
String r;
|
||||
int code = HostSys(cmd + temp_path, r);
|
||||
DDUMP(code);
|
||||
|
||||
DeleteFile(temp_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,11 +2,25 @@
|
|||
|
||||
void Ide::UpgradeTheIDE()
|
||||
{
|
||||
String idepath = GetExeFilePath();
|
||||
String newpath = idepath + ".new";
|
||||
String bakpath(~idepath, GetFileExtPos(idepath));
|
||||
bakpath << ".bak" << GetExeExt();
|
||||
String idepath, newpath, bakpath;
|
||||
#ifdef PLATFORM_COCOA
|
||||
idepath = GetAppFolder();
|
||||
String name = GetFileTitle(idepath);
|
||||
idepath = GetFileFolder(idepath);
|
||||
String target_dir = idepath + "/" + name + ".new";
|
||||
DeleteFolderDeep(target_dir);
|
||||
RealizeDirectory(target_dir);
|
||||
|
||||
newpath = target_dir + "/" + name + ".app";
|
||||
bakpath = idepath + "/" + name + ".bak.app";
|
||||
idepath << "/" << name << ".app";
|
||||
#else
|
||||
idepath = GetExeFilePath()
|
||||
newpath = idepath + ".new";
|
||||
bakpath = String(~idepath, GetFileExtPos(idepath));
|
||||
bakpath << ".bak" << GetExeExt();
|
||||
#endif
|
||||
|
||||
int tbak = targetmode;
|
||||
String tmbak = StoreAsString(release);
|
||||
|
||||
|
|
@ -26,7 +40,11 @@ void Ide::UpgradeTheIDE()
|
|||
targetmode = 1;
|
||||
|
||||
if(Build()) {
|
||||
FileDelete(bakpath);
|
||||
#ifdef PLATFORM_COCOA
|
||||
DeleteFolderDeep(bakpath);
|
||||
#else
|
||||
FileDelete(bakpath);
|
||||
#endif
|
||||
if(FileExists(bakpath))
|
||||
Exclamation("Unable to delete&" + bakpath);
|
||||
else {
|
||||
|
|
@ -34,10 +52,14 @@ void Ide::UpgradeTheIDE()
|
|||
FileMove(idepath, bakpath);
|
||||
PutVerbose("Moving " + newpath + " to " + idepath);
|
||||
FileMove(newpath, idepath);
|
||||
#ifdef PLATFORM_COCOA
|
||||
DeleteFolderDeep(target_dir);
|
||||
#endif
|
||||
PutConsole("Upgrade finished, please restart theide.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LoadFromString(release, tmbak);
|
||||
targetmode = tbak;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -416,15 +416,15 @@ void Ide::Setup(Bar& menu)
|
|||
}
|
||||
});
|
||||
|
||||
#ifndef PLATFORM_COCOA
|
||||
const Workspace& wspc = IdeWorkspace();
|
||||
if(wspc[0] == "ide")
|
||||
for(int i = 0; i < wspc.GetCount(); i++)
|
||||
if(wspc[i] == "ide/Core")
|
||||
if(wspc[i] == "ide/Core") {
|
||||
menu.Add("Upgrade TheIDE..", [=] { UpgradeTheIDE(); });
|
||||
#ifdef PLATFORM_POSIX
|
||||
break;
|
||||
}
|
||||
#ifndef PLATFORM_COCOA
|
||||
menu.Add("Install theide.desktop", [=] { InstallDesktop(); });
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(menu.IsMenuBar())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue