diff --git a/uppsrc/ide/Install.cpp b/uppsrc/ide/Install.cpp index 0c8752cda..5d0771e2b 100644 --- a/uppsrc/ide/Install.cpp +++ b/uppsrc/ide/Install.cpp @@ -3,6 +3,8 @@ #ifdef PLATFORM_WIN32 +#if 0 + String GetShellFolder(const char *name, HKEY type) { return GetWinRegString(name, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders", type); @@ -243,6 +245,8 @@ bool Install() return true; } +#endif + #else bool CopyFolder(const char *dst, const char *src, Progress *pi) diff --git a/uppsrc/ide/InstantSetup.cpp b/uppsrc/ide/InstantSetup.cpp index e0433bbc2..a526830a4 100644 --- a/uppsrc/ide/InstantSetup.cpp +++ b/uppsrc/ide/InstantSetup.cpp @@ -148,6 +148,8 @@ void InstantSetup() df.Dir(pf + "/microsoft visual studio 14.0"); df.Dir(pf); df.Dir(GetProgramsFolder()); + + String default_method; for(int x64 = 0; x64 < 2; x64++) { String method = x64 ? "MSC15x64" : "MSC15"; @@ -162,8 +164,11 @@ void InstantSetup() Vector bins = Split(bm.Get("PATH", ""), ';'); Vector incs = Split(bm.Get("INCLUDE", ""), ';'); Vector libs = Split(bm.Get("LIB", ""), ';'); - if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3)) + if(CheckDirs(bins, 2) && CheckDirs(incs, 4) && CheckDirs(libs, 3)) { + if(!x64) + default_method = "MSC15"; continue; + } vc = df.ScanForDir("/vc", "", "bin/link.exe;bin/cl.exe;bin/mspdb140.dll", "bin/1033"); bin = df.ScanForDir(x64 ? "bin/x64" : "bin/x86", "/windows kits/", "makecat.exe;accevent.exe", ""); @@ -217,10 +222,13 @@ void InstantSetup() bm.GetAdd("LIB") = Join(libs, ";"); SaveVarFile(ConfigFile(method + ".bm"), bm); + + if(!x64) + default_method = "MSC15"; } } - { + do { String method = "MINGW32"; #ifdef _DEBUG method << "Test"; @@ -230,8 +238,10 @@ void InstantSetup() Vector bins = Split(bm.Get("PATH", ""), ';'); Vector incs = Split(bm.Get("INCLUDE", ""), ';'); Vector libs = Split(bm.Get("LIB", ""), ';'); - if(CheckDirs(bins, 1) && CheckDirs(incs, 1) && CheckDirs(libs, 1)) - return; + if(CheckDirs(bins, 1) && CheckDirs(incs, 1) && CheckDirs(libs, 1)) { + default_method = Nvl(default_method, method); + break; + } String bin = GetExeDirFile("bin"); @@ -267,6 +277,73 @@ void InstantSetup() SaveVarFile(ConfigFile(method + ".bm"), bm); } + while(0); + + if(default_method.GetCount()) + SaveFile(GetExeDirFile("default_method"), default_method); + + static Tuple2 ass[] = { + { "uppsrc", "#/uppsrc" }, + { "reference", "#/reference;#/uppsrc" }, + { "examples", "#/examples;#/uppsrc" }, + { "tutorial", "#/tutorial;#/uppsrc" }, + { "examples-bazaar", "#/bazaar;#/uppsrc" }, + { "MyApps", "#/MyApps;#/uppsrc" }, + { "MyApps-bazaar", "#/MyApps;#/bazaar;#/uppsrc" }, + }; + + String exe = GetExeFilePath(); + String dir = GetFileFolder(exe); + String out = GetExeDirFile("out"); + RealizeDirectory(out); + + for(int i = 0; i < __countof(ass); i++) { + String vf = GetExeDirFile(String(ass[i].a) + ".var"); + VectorMap map; + bool ok = true; + if(LoadVarFile(vf, map)) { + Vector dir = Split(map.Get("UPP", String()), ';'); + if(dir.GetCount() == 0) { + ok = false; + break; + } + for(int j = 0; j < dir.GetCount(); j++) { + if(!DirectoryExists(dir[j])) { + ok = false; + break; + } + } + } + if(!ok) { + String b = ass[i].b; + b.Replace("#", dir); + SaveFile(vf, + "UPP = " + b + ";\r\n" + "OUTPUT = " + AsCString(out) + ";\r\n" + ); + } + } +} + +bool CheckLicense() +{ + if(!FileExists((GetExeDirFile("license.chk")))) + return true; + ShowSplash(); + Ctrl::ProcessEvents(); + Sleep(2000); + HideSplash(); + Ctrl::ProcessEvents(); + WithLicenseLayout d; + CtrlLayoutOKCancel(d, "License agreement"); + d.license = GetTopic("ide/app/BSD$en-us").text; + d.license.Margins(4); + d.license.SetZoom(Zoom(Zy(18), 100)); + d.ActiveFocus(d.license); + if(d.Run() != IDOK) + return false; + DeleteFile(GetExeDirFile("license.chk")); + return true; } #endif diff --git a/uppsrc/ide/ide.upp b/uppsrc/ide/ide.upp index 926b05ee4..8ac7e14b1 100644 --- a/uppsrc/ide/ide.upp +++ b/uppsrc/ide/ide.upp @@ -61,7 +61,6 @@ file Print.cpp, Insert.cpp, idetool.cpp, - Install.cpp, idebar.cpp, idewin.cpp, About.cpp, @@ -75,13 +74,14 @@ file Xml.cpp, Json.cpp, Update.cpp, + AutoSetup.cpp, + InstantSetup.cpp, + Install.cpp, Compile readonly separator, MethodsCtrls.h, MethodsCtrls.cpp, Methods.h, Methods.cpp, - AutoSetup.cpp, - InstantSetup.cpp, OutputMode.cpp, Build.cpp, Debug.cpp, diff --git a/uppsrc/ide/idebar.cpp b/uppsrc/ide/idebar.cpp index 6a2d3a70c..ace39bb72 100644 --- a/uppsrc/ide/idebar.cpp +++ b/uppsrc/ide/idebar.cpp @@ -341,8 +341,11 @@ void Ide::Setup(Bar& menu) menu.Add("Build methods..", THISBACK(SetupBuildMethods)) .Help("Setup build methods"); #ifdef PLATFORM_WIN32 - menu.Add("Automatic setup..", THISBACK(AutoSetup)) - .Help("Automatic setup of build methods.."); + if(console.verbosebuild) + menu.Add("Automatic setup..", THISBACK(AutoSetup)) + .Help("Automatic setup of build methods.."); + menu.Add("Instant setup..", callback(InstantSetup)) + .Help("Setups/fixes build methods and basic assemblies.."); #endif #ifdef PLATFORM_POSIX menu.Add("Source managment..", THISBACK(AutoSetup)) diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index 059ac1511..957b27b01 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -769,14 +769,14 @@ void AppMain___() #ifdef PLATFORM_WIN32 if(!CheckLicense()) return; - firstinstall = !IsNull(LoadFile(GetExeDirFile("install.upp"))); -#ifdef flagTESTINSTALL - firstinstall = true; + String upp_dir = GetFileFolder(GetExeFilePath()); + String cf = GetExeDirFile("setup-path"); +#ifndef _DEBUG + if(upp_dir != LoadFile(cf)) #endif - if(firstinstall) { - if(!Install()) - return; - SaveFile(ConfigFile("version"), IDE_VERSION); + { + InstantSetup(); + SaveFile(upp_dir, cf); } #endif @@ -784,12 +784,12 @@ void AppMain___() ResetBlitz(); for(int i = 0; i < arg.GetCount(); i++) { - if(arg[i] == "-uninstall") { +/* if(arg[i] == "-uninstall") { Uninstall(); return; } if(!firstinstall && arg[i] == "-install" && !Install()) return; - +*/ #ifdef PLATFORM_WIN32 if(arg[i] == "!") { String cmdline; @@ -832,7 +832,7 @@ void AppMain___() #endif } -#ifdef _DEBUG +#ifdef _DEBUG0 #ifdef PLATFORM_WIN32 InstantSetup(); #endif diff --git a/uppsrc/install.upp b/uppsrc/install.upp index d159e66bd..182705016 100644 --- a/uppsrc/install.upp +++ b/uppsrc/install.upp @@ -2,6 +2,6 @@ uppsrc.var|#\uppsrc|#\common|#\out reference.var|#\reference;#\uppsrc|#\common|#\out examples.var|#\examples;#\uppsrc|#\common|#\out tutorial.var|#\tutorial;#\uppsrc|#\common|#\out -bazaar.var|#\bazaar;#\uppsrc|#\common|#\out +examples-bazaar.var|#\bazaar;#\uppsrc|#\common|#\out MyApps.var|@;#\uppsrc|#\common|#\out MyAppsWBazaar.var|@;#\uppsrc|#\common|#\out