From 6d5abe9fd78ebb5477c6e665134d5232d2b2cedf Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 14 Jan 2021 11:46:34 +0000 Subject: [PATCH] ide: Removing stalled script files in posix git-svn-id: svn://ultimatepp.org/upp/trunk@15665 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Core/Host.cpp | 11 +++++++++++ uppsrc/ide/Core/Host.h | 4 ++++ uppsrc/ide/main.cpp | 2 ++ 3 files changed, 17 insertions(+) diff --git a/uppsrc/ide/Core/Host.cpp b/uppsrc/ide/Core/Host.cpp index b98d08f82..c5c55ef47 100644 --- a/uppsrc/ide/Core/Host.cpp +++ b/uppsrc/ide/Core/Host.cpp @@ -177,6 +177,17 @@ String HostConsole = "powershell.exe"; String HostConsole = "/usr/bin/xterm -e"; #endif +#ifdef PLATFORM_POSIX +void RemoveConsoleScripts() +{ + FileTime tm = (GetSysTime() - 24*3600).AsFileTime(); + for(FindFile ff(ConfigFile("console-script-*")); ff; ff++) { + if(ff.GetLastWriteTime() < tm) + FileDelete(ff.GetPath()); + } +} +#endif + void Host::Launch(const char *_cmdline, bool console) { String cmdline = FindCommand(exedirs, _cmdline); diff --git a/uppsrc/ide/Core/Host.h b/uppsrc/ide/Core/Host.h index cb5b8bd82..a2afa0728 100644 --- a/uppsrc/ide/Core/Host.h +++ b/uppsrc/ide/Core/Host.h @@ -43,3 +43,7 @@ struct Host { private: bool HasPlatformFlag(const Index& cfg); }; + +#ifdef PLATFORM_POSIX +void RemoveConsoleScripts(); +#endif \ No newline at end of file diff --git a/uppsrc/ide/main.cpp b/uppsrc/ide/main.cpp index 2641f2269..499a3ea0d 100644 --- a/uppsrc/ide/main.cpp +++ b/uppsrc/ide/main.cpp @@ -153,6 +153,8 @@ void AppMain___() bool hasvars = FindFile(ConfigFile("*.var")); #ifdef PLATFORM_POSIX + RemoveConsoleScripts(); // remove old console-script files + String home = Environment().Get("UPP_HOME", Null); if(!IsNull(home)) SetHomeDirectory(home);