ide: Developing UppHub

git-svn-id: svn://ultimatepp.org/upp/trunk@15509 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2020-11-24 12:05:50 +00:00
parent b57c0fdfda
commit 6234e9adbf
5 changed files with 25 additions and 28 deletions

View file

@ -166,18 +166,18 @@ bool SaveVars(const char *name)
return true;
}
String DefaultUpvFilePath()
String DefaultHubFilePath()
{
return ConfigFile("uppiverse.path");
return ConfigFile("UppHub.path");
}
String GetUpvDir()
String GetHubDir()
{
String d = GetVar("UPPIVERSE");
String d = GetVar("UPPHUB");
if(d.GetCount() && DirectoryExists(d)) return d;
d = LoadFile(DefaultUpvFilePath());
d = LoadFile(DefaultHubFilePath());
if(d.GetCount() && DirectoryExists(d)) return d;
d = ConfigFile("uppiverse");
d = ConfigFile("UppHub");
RealizeDirectory(d);
return d;
}
@ -197,29 +197,26 @@ void SetVar(const String& var, const String& val, bool save) {
SaveVars(GetVarsName());
}
bool upv_loaded;
bool hub_loaded;
Vector<String> GetUppDirs() {
Vector<String> s = SplitDirs(GetVar("UPP"));
static Vector<String> upv_dirs;
if(!upv_loaded) {
upv_dirs.Clear();
FindFile ff(GetUpvDir() + "/*.*");
while(ff) {
static Vector<String> hub_dirs;
if(!hub_loaded) {
hub_dirs.Clear();
for(const FindFile& ff : FindFile(GetHubDir() + "/*.*"))
if(ff.IsFolder())
upv_dirs.Add(ff.GetPath());
ff.Next();
}
upv_loaded = true;
hub_dirs.Add(ff.GetPath());
hub_loaded = true;
}
s.Append(upv_dirs);
s.Append(hub_dirs);
return s;
}
void Nest::InvalidatePackageCache()
{
package_cache.Clear();
upv_loaded = false;
hub_loaded = false;
}
String GetUppDir() {

View file

@ -204,9 +204,9 @@ public:
Nest& MainNest();
String DefaultUpvFilePath();
String DefaultHubFilePath();
String GetUpvDir();
String GetHubDir();
String VarFilePath();
String VarFilePath(String name);

View file

@ -574,9 +574,9 @@ void Ide::SetupFormat() {
AddPath(&ide.uscpath);
};
String upv_path = DefaultUpvFilePath();
ide.uppiverse <<= LoadFile(upv_path);
DirSelect(ide.uppiverse, ide.uppiverse_sel);
String hub_path = DefaultHubFilePath();
ide.upphub <<= LoadFile(hub_path);
DirSelect(ide.upphub, ide.upphub_sel);
fnt.defaults << [&] {
Ide def;
@ -592,7 +592,7 @@ void Ide::SetupFormat() {
for(;;) {
int c = dlg.Run();
Upp::SaveFile(upv_path, ~ide.uscpath);
Upp::SaveFile(hub_path, ~ide.uscpath);
if(IsNull(ide.uscpath))
FileDelete(usc_path);

View file

@ -115,7 +115,7 @@ void UpvDlg::Install()
cmd << "-b " + branch + " " + repo2;
else
cmd << repo;
cmd << ' ' << GetUpvDir() << '/' << list.Get(i, 1);
cmd << ' ' << GetHubDir() << '/' << list.Get(i, 1);
if(console.System(cmd))
break;
}

View file

@ -617,9 +617,9 @@ LAYOUT(SetupIdeLayout, 512, 336)
ITEM(Upp::Label, dv___28, SetLabel(t_("In editor mode, path for .usc files")).LeftPosZ(4, 192).TopPosZ(288, 20))
ITEM(Upp::EditString, uscpath, HSizePosZ(172, 28).TopPosZ(288, 19))
ITEM(Upp::Button, uscpath_sel, RightPosZ(4, 20).BottomPosZ(29, 19))
ITEM(Upp::Label, dv___31, SetLabel(t_("Default uppiverse folder")).LeftPosZ(4, 192).BottomPosZ(4, 20))
ITEM(Upp::EditString, uppiverse, HSizePosZ(172, 28).BottomPosZ(5, 19))
ITEM(Upp::Button, uppiverse_sel, RightPosZ(4, 20).BottomPosZ(5, 19))
ITEM(Upp::Label, dv___31, SetLabel(t_("Default UppHub folder")).LeftPosZ(4, 192).BottomPosZ(4, 20))
ITEM(Upp::EditString, upphub, HSizePosZ(172, 28).BottomPosZ(5, 19))
ITEM(Upp::Button, upphub_sel, RightPosZ(4, 20).BottomPosZ(5, 19))
END_LAYOUT
LAYOUT(SetupAstyleLayout, 544, 312)