summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/app.c b/src/app.c
index 4d125ed8..f4d9f30b 100644
--- a/src/app.c
+++ b/src/app.c
@@ -55,6 +55,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
55#include <the_Foundation/process.h> 55#include <the_Foundation/process.h>
56#include <the_Foundation/sortedarray.h> 56#include <the_Foundation/sortedarray.h>
57#include <the_Foundation/time.h> 57#include <the_Foundation/time.h>
58#include <the_Foundation/version.h>
58#include <SDL.h> 59#include <SDL.h>
59 60
60#include <stdio.h> 61#include <stdio.h>
@@ -176,6 +177,7 @@ const iString *dateStr_(const iDate *date) {
176 177
177static iString *serializePrefs_App_(const iApp *d) { 178static iString *serializePrefs_App_(const iApp *d) {
178 iString *str = new_String(); 179 iString *str = new_String();
180 appendCStr_String(str, "version app:" LAGRANGE_APP_VERSION "\n");
179#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 181#if defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
180 appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame); 182 appendFormat_String(str, "customframe arg:%d\n", d->prefs.customFrame);
181#endif 183#endif
@@ -336,6 +338,7 @@ static void loadPrefs_App_(iApp *d) {
336 iUnused(d); 338 iUnused(d);
337 iBool haveCA = iFalse; 339 iBool haveCA = iFalse;
338 d->isLoadingPrefs = iTrue; /* affects which notifications get posted */ 340 d->isLoadingPrefs = iTrue; /* affects which notifications get posted */
341 iVersion upgradedFromAppVersion = { 0 };
339 /* Create the data dir if it doesn't exist yet. */ 342 /* Create the data dir if it doesn't exist yet. */
340 makeDirs_Path(collectNewCStr_String(dataDir_App_())); 343 makeDirs_Path(collectNewCStr_String(dataDir_App_()));
341 iFile *f = new_File(prefsFileName_()); 344 iFile *f = new_File(prefsFileName_());
@@ -379,6 +382,11 @@ static void loadPrefs_App_(iApp *d) {
379 continue; /* can't change downloads directory */ 382 continue; /* can't change downloads directory */
380 } 383 }
381#endif 384#endif
385 else if (equal_Command(cmd, "version")) {
386 /* This is a special command that lets us know which version we're upgrading from.
387 It was added in v1.8.0. */
388 init_Version(&upgradedFromAppVersion, range_Command(cmd, "app"));
389 }
382 else { 390 else {
383 postCommandString_Root(NULL, &cmdStr); 391 postCommandString_Root(NULL, &cmdStr);
384 } 392 }
@@ -391,10 +399,17 @@ static void loadPrefs_App_(iApp *d) {
391 setCACertificates_TlsRequest(&d->prefs.strings[caFile_PrefsString], 399 setCACertificates_TlsRequest(&d->prefs.strings[caFile_PrefsString],
392 &d->prefs.strings[caPath_PrefsString]); 400 &d->prefs.strings[caPath_PrefsString]);
393 } 401 }
402 iRelease(f);
403 /* Upgrade checks. */
404 if (cmp_Version(&upgradedFromAppVersion, &(iVersion){ 1, 8, 0 }) < 0) {
405 /* When upgrading to v1.8.0, the old hardcoded font library is gone and that means
406 UI strings may not have the right fonts available for the UI to remain
407 usable. */
408 postCommandf_App("uilang id:en");
409 }
394#if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME) 410#if !defined (LAGRANGE_ENABLE_CUSTOM_FRAME)
395 d->prefs.customFrame = iFalse; 411 d->prefs.customFrame = iFalse;
396#endif 412#endif
397 iRelease(f);
398 d->isLoadingPrefs = iFalse; 413 d->isLoadingPrefs = iFalse;
399} 414}
400 415