diff --git a/configuration/config_object.go b/configuration/config_object.go index ed14a23..d846412 100644 --- a/configuration/config_object.go +++ b/configuration/config_object.go @@ -22,6 +22,18 @@ type Config struct { TEMP map[string]string } +func (c *Config) initializePathsMac() { + fmt.Println("Initializing configuration paths...") + home_path := os.Getenv("HOME") + data_path := path.Join(home_path, "Library", "Application Support", "URTrator") + fmt.Println("Will use data path: " + data_path) + c.TEMP["DATA"] = data_path + + if _, err := os.Stat(data_path); os.IsNotExist(err) { + os.MkdirAll(data_path, 0755) + } +} + func (c *Config) initializePathsNix() { fmt.Println("Initializing configuration paths...") @@ -47,6 +59,8 @@ func (c *Config) Initialize() { if runtime.GOOS == "linux" { c.initializePathsNix() + } else if runtime.GOOS == "darwin" { + c.initializePathsMac() } else { panic("We're not ready for other OSes yet!") } diff --git a/database/migrations.go b/database/migrations.go index 5efb30b..bb0e0de 100644 --- a/database/migrations.go +++ b/database/migrations.go @@ -51,6 +51,10 @@ func migrate_full(db *Database, version int) { two_to_three(db) version = 3 } + if version == 3 { + three_to_four(db) + version = 4 + } } // Initial database structure. @@ -75,3 +79,9 @@ func two_to_three(db *Database) { db.Db.MustExec("CREATE TABLE urt_profiles (name VARCHAR(128) NOT NULL, version VARCHAR(5) NOT NULL DEFAULT '4.3', binary VARCHAR(1024) NOT NULL, second_x_session VARCHAR(1) NOT NULL DEFAULT '0', additional_parameters VARCHAR(1024) NOT NULL DEFAULT '')") db.Db.MustExec("UPDATE database SET version=3") } + +// UrT version inconsistency. +func three_to_four(db *Database) { + fmt.Println("Upgrading database from 3 to 4...") + db.Db.MustExec("UPDATE urt_profiles SET version='4.3.0' WHERE version='4.3.000'") +} diff --git a/ui/options_profile.go b/ui/options_profile.go index 3d7267a..d8f95c1 100644 --- a/ui/options_profile.go +++ b/ui/options_profile.go @@ -131,7 +131,7 @@ func (op *OptionsProfile) Initialize(update bool, lp func()) { urt_version_sep := gtk.NewHSeparator() op.urt_version_combo = gtk.NewComboBoxText() op.urt_version_combo.AppendText("4.2.023") - op.urt_version_combo.AppendText("4.3.000") + op.urt_version_combo.AppendText("4.3.0") op.urt_version_combo.SetActive(1) urt_version_hbox.PackStart(urt_version_label, false, true, 5) urt_version_hbox.PackStart(urt_version_sep, true, true, 5) @@ -212,7 +212,7 @@ func (op *OptionsProfile) InitializeUpdate(profile_name string, lp func()) { op.another_x_session.SetActive(true) } - if profile[0].Version == "4.3.000" { + if profile[0].Version == "4.3.0" { op.urt_version_combo.SetActive(1) } else { op.urt_version_combo.SetActive(0)