ide: Removing stalled script files in posix

git-svn-id: svn://ultimatepp.org/upp/trunk@15665 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2021-01-14 11:46:34 +00:00
parent 82333b3d99
commit 6d5abe9fd7
3 changed files with 17 additions and 0 deletions

View file

@ -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);

View file

@ -43,3 +43,7 @@ struct Host {
private:
bool HasPlatformFlag(const Index<String>& cfg);
};
#ifdef PLATFORM_POSIX
void RemoveConsoleScripts();
#endif

View file

@ -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);