Commit 400600d6 authored by John van Groningen's avatar John van Groningen

remove usage of the version resource of the CleanIDE on windows

parent 211f0e22
......@@ -95,7 +95,7 @@ PrefsFileName :== "IDEPrefs"
}
:: RegPrefs =
{ rp_flags :: ![(String,String,String)]
{ rp_flags :: ![(String,String)]
// should use registry entries for the following instead of Prefs file...
, tp_name :: !String
, tp_path :: !String
......
......@@ -93,7 +93,7 @@ PrefsFileName :== "IDEPrefs"
}
:: RegPrefs =
{ rp_flags :: ![(String,String,String)]
{ rp_flags :: ![(String,String)]
, tp_name :: !String
, tp_path :: !String
, hp_name :: !String
......@@ -441,7 +441,7 @@ where
RegPrefsOptionsTable :: OptionsTable RegPrefs
RegPrefsOptionsTable =
{ ListOption "ClideFlags" FlagOption ("","","") (\a->ListToStrictList a.rp_flags) (\v a->{a & rp_flags=StrictListToList v})
{ ListOption "ClideFlags" FlagOption ("","") (\a->ListToStrictList a.rp_flags) (\v a->{a & rp_flags=StrictListToList v})
, SimpleOption "TimepName" (\a->a.tp_name) (\v a->{a & tp_name=v})
, SimpleOption "TimepPath" (\a->a.tp_path) (\v a->{a & tp_path=v})
, SimpleOption "HeappName" (\a->a.hp_name) (\v a->{a & hp_name=v})
......@@ -454,11 +454,10 @@ RegPrefsOptionsTable =
FlagOption = GroupedOption "Flags" FlagsOptionsTable id const
FlagsOptionsTable :: OptionsTable (String,String,String)
FlagsOptionsTable :: OptionsTable (String,String)
FlagsOptionsTable =
{ SimpleOption "fName" (\(a,_,_)->a) (\v (a,b,c)->(v,b,c))
, SimpleOption "fPath" (\(_,a,_)->a) (\v (a,b,c)->(a,v,c))
, SimpleOption "fVers" (\(_,_,a)->a) (\v (a,b,c)->(a,b,v))
{ SimpleOption "fName" (\(a,_)->a) (\v (a,b)->(v,b))
, SimpleOption "fPath" (\(_,a)->a) (\v (a,b)->(a,v))
}
ErrPrefsOptionsTable :: OptionsTable ErrPrefs
......
......@@ -2,11 +2,10 @@ definition module first_run
from StdPSt import :: PSt
first_run :: !String !String !String !String ![(String,String,String)] !(PSt .ls) -> (!Bool,(String,String,String),!PSt .ls)
first_run :: !String !String !String !String ![(String,String)] !(PSt .ls) -> (!Bool,(String,String),!PSt .ls)
change_hcl_registry_fun :: !String !String !String !String -> [String]
change_pcl_registry_fun :: !String !String !String !String -> [String]
GetVNP :: (String,String,String)
get_ide_from_registry :: (!String,!String,!String,![String])
get_ide_from_registry :: (!String,!String,![String])
GetFileName :: !String -> String;
GetFilePath :: !String -> String;
uninstall :: !(PSt .ls) -> (![String],!PSt .ls)
......@@ -16,40 +16,14 @@ GetLastError = code {
//==
GetVNP :: (String,String,String)
GetVNP = (app_vers,app_name,app_path)
GetApplicationNameAndPath :: (String,String)
GetApplicationNameAndPath = (app_name,app_path)
where
path = winGetModulePath
long_path = GetLongPathName path
app_name = GetFileName long_path
app_path = GetFilePath path
app_vers = ReadVersionInfo
//==
/*
Start`` w = startIO NDI Void pinit [ProcessClose closeProcess] w
pinit ps
# ((flag_name,flag_path,flag_vers),ps) = read_version_flag ps
# flags = [(flag_name,flag_path,flag_vers)]
# (res,ps) = first_run ide_vers ide_name ide_path pcl_name pcl_path hcl_name hcl_path flags ps
# ps = case res of
True -> write_version_flag (ide_name,ide_path,ide_vers) ps
_ -> ps
= finish ps
where
path = winGetModulePath
long_path = GetLongPathName path
// ide_name = GetFileName long_path
// ide_path = GetFilePath path
ide_name = "CleanIDE.exe"
ide_path = "C:\\CLEAN\\"
ide_vers = ReadVersionInfo
pcl_name = "ShowTimeProfile.exe"
pcl_path = "C:\\CLEAN\\TOOLS\\TIMEPR~1\\"
hcl_name = "ShowHeapProfile.exe"
hcl_path = "C:\\CLEAN\\TOOLS\\HEAPPR~1\\"
*/
GetFileName :: !String -> String;
GetFileName path
| found = (path % (inc position, dec (size path)));
......@@ -144,9 +118,9 @@ where
| No
| Never
first_run :: !String !String !String !String ![(String,String,String)] !(PSt .ls) -> (!Bool,(String,String,String),!PSt .ls)
first_run :: !String !String !String !String ![(String,String)] !(PSt .ls) -> (!Bool,(String,String),!PSt .ls)
first_run pcl_name pcl_path hcl_name hcl_path flags ps
# (ide_vers,ide_name,ide_path) = GetVNP
# (ide_name,ide_path) = GetApplicationNameAndPath
# (app_path,ps) = accFiles GetFullApplicationPath ps
# app_path = GetLongPathName app_path
# pcl_path = fulAppPath app_path pcl_path
......@@ -157,35 +131,35 @@ first_run pcl_name pcl_path hcl_name hcl_path flags ps
# hcl_path = case GetShortPathName hcl_path of
(True,hcl_path) -> hcl_path
_ -> hcl_path
# (run,ps) = check_flags ide_vers ide_path ide_name flags ps
# (run,ps) = check_flags ide_path ide_name flags ps
| not run
= (False,(ide_name,ide_path,ide_vers),ps)
# (res,ps) = check_registry ide_name ide_path ide_vers ps
= (False,(ide_name,ide_path),ps)
# (res,ps) = check_registry ide_name ide_path ps
= case res of
MyEntry -> (False,(ide_name,ide_path,ide_vers),ps)
MyEntry -> (False,(ide_name,ide_path),ps)
NoEntry
# (res,ps) = init_dialog ps
-> case res of
Yes # (err,ps) = set_registry ide_vers ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
Yes # (err,ps) = set_registry ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
| err <> ""
# ps = err_dialog False err ps
-> (False,(ide_name,ide_path,ide_vers),ps)
-> (False,(ide_name,ide_path,ide_vers),ps)
No -> (False,(ide_name,ide_path,ide_vers),ps)
Never -> (True,(ide_name,ide_path,ide_vers),ps)
-> (False,(ide_name,ide_path),ps)
-> (False,(ide_name,ide_path),ps)
No -> (False,(ide_name,ide_path),ps)
Never -> (True,(ide_name,ide_path),ps)
DiffEntry
# (res,ps) = delta_dialog ps
-> case res of
Yes # (err,ps) = set_registry ide_vers ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
Yes # (err,ps) = set_registry ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
| err <> ""
# ps = err_dialog False err ps
-> (False,(ide_name,ide_path,ide_vers),ps)
-> (False,(ide_name,ide_path,ide_vers),ps)
No -> (False,(ide_name,ide_path,ide_vers),ps)
Never -> (True,(ide_name,ide_path,ide_vers),ps)
-> (False,(ide_name,ide_path),ps)
-> (False,(ide_name,ide_path),ps)
No -> (False,(ide_name,ide_path),ps)
Never -> (True,(ide_name,ide_path),ps)
ErrEntry err
# ps = err_dialog True err ps
-> (False,(ide_name,ide_path,ide_vers),ps)
-> (False,(ide_name,ide_path),ps)
uninstall :: !(PSt .ls) -> (![String],!PSt .ls)
......@@ -228,25 +202,25 @@ write_version_flag (flag_name,flag_path,flag_vers) ps
where
writeln s f = f <<< s <<< '\n'
check_flags :: !String !String !String ![(String,String,String)] !(PSt .l) -> (!Bool,!PSt .l)
check_flags _ _ _ [] ps = (True,ps)
check_flags app_vers app_path app_name [(flag_name,flag_path,flag_vers):flags] ps
| app_vers == flag_vers && app_path == flag_path && app_name == flag_name
check_flags :: !String !String ![(String,String)] !(PSt .l) -> (!Bool,!PSt .l)
check_flags _ _ [] ps = (True,ps)
check_flags app_path app_name [(flag_name,flag_path):flags] ps
| app_path == flag_path && app_name == flag_name
= (False,ps)
= check_flags app_vers app_path app_name flags ps
= check_flags app_path app_name flags ps
check_registry :: !String !String !String !(PSt .l) -> (!CheckResult,!PSt .l)
check_registry app_name app_path app_vers ps
# (name,path,vers,errs) = get_ide_from_registry
check_registry :: !String !String !(PSt .l) -> (!CheckResult,!PSt .l)
check_registry app_name app_path ps
# (name,path,errs) = get_ide_from_registry
| notEmpty errs
= (NoEntry,ps)
| name <> app_name || path <> app_path || vers <> app_vers
| name <> app_name || path <> app_path
= (DiffEntry,ps)
= (MyEntry,ps)
set_registry :: !String !String !String !String !String !String !String !(PSt .l) -> (!String,!PSt .l)
set_registry ide_vers ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
# (err,r) = enter_ide_in_registry (ide_name+++"\0") (ide_path+++"\0") (ide_vers+++"\0") [] 7
set_registry :: !String !String !String !String !String !String !(PSt .l) -> (!String,!PSt .l)
set_registry ide_name ide_path pcl_name pcl_path hcl_name hcl_path ps
# (err,r) = enter_ide_in_registry (ide_name+++"\0") (ide_path+++"\0") [] 7
| notEmpty err || r <> 7
= (hd err,ps)
# err = change_ide_registry_fun ide_name ide_path
......@@ -554,29 +528,26 @@ where
, fm_icon :: !Maybe String // resource identifier string [NULL-terminated]
}
enter_ide_in_registry name path vers e rs
enter_ide_in_registry name path e rs
# (e,rs) = add_to_registry ["Software\0","Clean\0"] "\0" True e rs
# (e,rs) = add_to_registry ["Software\0","Clean\0","CleanIDE\0"] "\0" True e rs
# (e,rs) = add_to_registry ["Software\0","Clean\0","CleanIDE\0","Name\0"] name True e rs
# (e,rs) = add_to_registry ["Software\0","Clean\0","CleanIDE\0","Path\0"] path True e rs
# (e,rs) = add_to_registry ["Software\0","Clean\0","CleanIDE\0","Vers\0"] vers True e rs
= (e,rs)
remove_ide_from_registry e rs
# (e,rs)=remove_from_registry ["Software\0","Clean\0","CleanIDE\0","Name\0"] e rs
# (e,rs)=remove_from_registry ["Software\0","Clean\0","CleanIDE\0","Path\0"] e rs
# (e,rs)=remove_from_registry ["Software\0","Clean\0","CleanIDE\0","Vers\0"] e rs
# (e,rs)=remove_from_registry ["Software\0","Clean\0","CleanIDE\0"] e rs
# (e,rs)=remove_from_registry ["Software\0","Clean\0"] e rs
= (e,rs)
get_ide_from_registry :: (!String,!String,!String,![String])
get_ide_from_registry :: (!String,!String,![String])
get_ide_from_registry
# rs = 7
# (nerr,name,rs) = check_registry_key ["Software\0","Clean\0","CleanIDE\0","Name\0"] rs
# (perr,path,rs) = check_registry_key ["Software\0","Clean\0","CleanIDE\0","Path\0"] rs
# (verr,vers,rs) = check_registry_key ["Software\0","Clean\0","CleanIDE\0","Vers\0"] rs
= (name,path,vers,nerr++perr++verr)
= (name,path,nerr++perr)
enter_file_type_in_registry :: !FileMapping [String] !RegistryState -> (![String],!RegistryState)
enter_file_type_in_registry fm e rs
......
......@@ -35,4 +35,3 @@ updtBM :== 32519
urunBM :== 32520
helpItems :: !Id !Id !*(PSt .a) -> *PSt .a
EXE_VERSION :: String
......@@ -318,8 +318,3 @@ help path file wId ps
# path = path +++. file
# (ret,ps) = ShellDefault path ps
= ps
EXE_VERSION :: String
EXE_VERSION
= toString (fst3 GetVNP)
......@@ -155,9 +155,9 @@ setTP tpId ps
# ps = appPIO (setControlText tpId (spath +++ name)) ps
# prefs = {prefs & reg_prefs.tp_name = name, reg_prefs.tp_path = spath}
# ps = setPrefs prefs ps
# (ide_name,ide_path,ide_vers,errs)
# (ide_name,ide_path,errs)
= get_ide_from_registry
| not (isEmpty errs) || ide_name == "" || ide_path == "" || ide_vers == "" = ps
| not (isEmpty errs) || ide_name == "" || ide_path == "" = ps
# errs = change_pcl_registry_fun ide_name ide_path name rpath
| errs == [] = ps
= ps
......@@ -177,9 +177,9 @@ setHP hpId ps
# ps = appPIO (setControlText hpId (spath +++ name)) ps
# prefs = {prefs & reg_prefs.hp_name = name, reg_prefs.hp_path = spath}
# ps = setPrefs prefs ps
# (ide_name,ide_path,ide_vers,errs)
# (ide_name,ide_path,errs)
= get_ide_from_registry
| not (isEmpty errs) || ide_name == "" || ide_path == "" || ide_vers == "" = ps
| not (isEmpty errs) || ide_name == "" || ide_path == "" = ps
# errs = change_hcl_registry_fun ide_name ide_path name rpath
| errs == [] = ps
= ps
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment