ide: GetUppOut now defaults to initial value and can be empty (and is by default)

This commit is contained in:
Mirek Fidler 2024-06-27 11:56:56 +02:00
parent 5db8ced47b
commit 4f79424b90
12 changed files with 47 additions and 40 deletions

View file

@ -203,12 +203,13 @@ BaseSetupDlg::BaseSetupDlg()
DirSelect(output, output_sel);
DirSelect(upv, upv_sel);
upv.NullText(GetHubDir());
output.NullText(GetUppOut());
}
bool BaseSetupDlg::Run(String& vars)
{
upp <<= GetVar("UPP");
output <<= GetVar("OUTPUT");
output <<= GetUppOut();
upv <<= GetVar("UPPHUB");
base <<= vars;
new_base = IsNull(vars);

View file

@ -119,7 +119,7 @@ void Ide::PackageClean()
void Ide::CleanUppOut()
{
String out = GetVar("OUTPUT");
String out = GetOutputDir();
if(!PromptYesNo(Format("Erase the whole output directory [* \1%s\1]?", out)))
return;
console.Clear();

View file

@ -261,7 +261,7 @@ String MakeBuild::OutDir(const Index<String>& cfg, const String& package, const
Sort(x);
for(int i = 0; i < x.GetCount(); i++)
x[i] = InitCaps(x[i]);
String outdir = GetVar("OUTPUT");
String outdir = GetUppOut();
if(output_per_assembly)
outdir = AppendFileName(outdir, GetAssemblyId());
if(!use_target)

View file

@ -174,7 +174,7 @@ void MakeBuild::SaveCCJ(const String& fn, bool exporting)
String makefile;
Vector<String> uppdirs = GetUppDirs();
String uppout = exporting ? GetVar("OUTPUT") : ".cache/upp.out";
String uppout = exporting ? GetUppOut() : ".cache/upp.out";
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, host, *b);
bool win32 = allconfig.Find("WIN32") >= 0;

View file

@ -194,30 +194,4 @@ void CreateBuildMethods()
#endif
}
String GetDefaultUppOut()
{
String out;
String p = GetExeFolder();
while(p.GetCount() > 1 && DirectoryExists(p)) {
String h = AppendFileName(p, ".cache");
if(DirectoryExists(h)) {
out = h;
break;
}
p = GetFileFolder(p);
}
out = Nvl(out, GetHomeDirFile(".cache")) + "/upp.out";
RealizeDirectory(out);
return out;
}
#else
String GetDefaultUppOut()
{
return ConfigFile("_out");
}
#endif

View file

@ -283,7 +283,7 @@ void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
String makefile;
Vector<String> uppdirs = GetUppDirs();
String uppout = exporting ? GetVar("OUTPUT") : ".cache/upp.out";
String uppout = exporting ? GetUppOut() : ".cache/upp.out";
String inclist;
Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, host, *b);

View file

@ -151,6 +151,41 @@ bool SaveVars(const char *name)
return true;
}
#ifdef PLATFORM_POSIX
String GetDefaultUppOut()
{
String out;
String p = GetExeFolder();
while(p.GetCount() > 1 && DirectoryExists(p)) {
String h = AppendFileName(p, ".cache");
if(DirectoryExists(h)) {
out = h;
break;
}
p = GetFileFolder(p);
}
out = Nvl(out, GetHomeDirFile(".cache")) + "/upp.out";
RealizeDirectory(out);
return out;
}
#else
String GetDefaultUppOut()
{
return ConfigFile("out");
}
#endif
String GetUppOut()
{
return Nvl(GetVar("OUTPUT"), GetDefaultUppOut());
}
String DefaultHubFilePath()
{
return ConfigFile("UppHub.path");

View file

@ -293,6 +293,8 @@ public:
Nest& MainNest();
String GetUppOut();
String DefaultHubFilePath();
void SetHubDir(const String& path);

View file

@ -99,7 +99,7 @@ bool Ide::FindLineError(const String& ln, FindLineErrorCache& cache, ListLineInf
if(IsNull(f.message))
f.message = ln;
Vector<String> conf = SplitFlags(mainconfigparam, true);
String uppout = GetVar("OUTPUT");
String uppout = GetOutputDir();
int upplen = uppout.GetLength();
if(cache.is_java && f.file.GetLength() > upplen
&& !MemICmp(f.file, uppout, upplen) && f.file[upplen] == DIR_SEP) { // check for preprocessed file

View file

@ -486,8 +486,7 @@ void InstantSetup()
String exe = GetExeFilePath();
String dir = GetFileFolder(exe);
String out = GetExeDirFile("out");
RealizeDirectory(out);
RealizeDirectory(GetUppOut());
for(int i = 0; i < __countof(ass); i++) {
String vf = GetExeDirFile(String(ass[i].a) + ".var");
@ -510,7 +509,6 @@ void InstantSetup()
b.Replace("#", dir);
SaveFile(vf,
"UPP = " + AsCString(b) + ";\r\n"
"OUTPUT = " + AsCString(out) + ";\r\n"
);
dirty = true;
}

View file

@ -38,15 +38,13 @@ bool SetupGITMaster()
}
#ifdef PLATFORM_WIN32
String out = GetExeDirFile("out");
String ass = GetExeFolder();
String myapps = GetExeDirFile("MyApps");
#else
String out = GetHomeDirFile("out");
String ass = GetConfigFolder();
String myapps = GetHomeDirFile("MyApps");
#endif
RealizeDirectory(out);
RealizeDirectory(GetUppOut());
String uppsrc = AppendFileName(dir, "uppsrc");
@ -58,7 +56,6 @@ bool SetupGITMaster()
console.Log("Creating assembly " + a);
SaveFile(a,
"UPP = " + AsCString(b) + ";\r\n"
"OUTPUT = " + AsCString(out) + ";\r\n"
);
};

View file

@ -223,7 +223,7 @@ CONSOLE_APP_MAIN
PutVerbose("Assembly file: " + v);
PutVerbose("Assembly: " + GetVar("UPP"));
}
PutVerbose("Output directory: " + GetVar("OUTPUT"));
PutVerbose("Output directory: " + GetUppOut());
ide.main = param[1];
v = SourcePath(ide.main, GetFileTitle(ide.main) + ".upp");
PutVerbose("Main package: " + v);