summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt6
-rw-r--r--res/Embed.cmake2
-rw-r--r--res/about/help.gmi4
-rw-r--r--src/app.c19
-rw-r--r--src/gmcerts.c12
5 files changed, 24 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e27956cd..e8ee03b5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -86,7 +86,7 @@ if (UNIX AND NOT APPLE)
86endif () 86endif ()
87embed_make (${EMBED_RESOURCES}) 87embed_make (${EMBED_RESOURCES})
88 88
89set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary) 89set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
90set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 90set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
91 91
92# Source files. 92# Source files.
@@ -177,7 +177,7 @@ set (SOURCES
177 res/about/help.gmi 177 res/about/help.gmi
178 res/about/lagrange.gmi 178 res/about/lagrange.gmi
179 res/about/version.gmi 179 res/about/version.gmi
180 ${CMAKE_CURRENT_BINARY_DIR}/resources.binary 180 ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr
181 ${CMAKE_CURRENT_BINARY_DIR}/embedded.c 181 ${CMAKE_CURRENT_BINARY_DIR}/embedded.c
182 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h 182 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h
183) 183)
@@ -301,7 +301,7 @@ MimeType=x-scheme-handler/gemini;x-scheme-handler/gopher
301 ) 301 )
302 if (NOT ENABLE_RESOURCE_EMBED) 302 if (NOT ENABLE_RESOURCE_EMBED)
303 target_compile_definitions (app PUBLIC 303 target_compile_definitions (app PUBLIC
304 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.binary") 304 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr")
305 install (FILES ${EMB_BIN} DESTINATION share/lagrange) 305 install (FILES ${EMB_BIN} DESTINATION share/lagrange)
306 endif () 306 endif ()
307endif () 307endif ()
diff --git a/res/Embed.cmake b/res/Embed.cmake
index f21cfb14..3b65b36c 100644
--- a/res/Embed.cmake
+++ b/res/Embed.cmake
@@ -96,7 +96,7 @@ function (embed_make)
96 endforeach (fn) 96 endforeach (fn)
97 else () 97 else ()
98 # Collect resources in a single binary file. 98 # Collect resources in a single binary file.
99 set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary) 99 set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
100 file (REMOVE ${EMB_BIN}) 100 file (REMOVE ${EMB_BIN})
101 list (LENGTH ARGV fileCount) 101 list (LENGTH ARGV fileCount)
102 execute_process (COMMAND ${BINCAT_COMMAND} ${EMB_BIN} ${ARGV} 102 execute_process (COMMAND ${BINCAT_COMMAND} ${EMB_BIN} ${ARGV}
diff --git a/res/about/help.gmi b/res/about/help.gmi
index 86fec802..7260aeb5 100644
--- a/res/about/help.gmi
+++ b/res/about/help.gmi
@@ -344,10 +344,10 @@ Other Unix : ~/.config/lagrange/
344* bindings.txt 344* bindings.txt
345* bookmarks.txt 345* bookmarks.txt
346* feeds.txt 346* feeds.txt
347* idents.binary and idents/ 347* idents.lgr and idents/
348* mimehooks.txt 348* mimehooks.txt
349* prefs.cfg 349* prefs.cfg
350* state.binary 350* state.lgr
351* trusted.txt 351* trusted.txt
352* visited.txt 352* visited.txt
353 353
diff --git a/src/app.c b/src/app.c
index 8ee09651..a46a6976 100644
--- a/src/app.c
+++ b/src/app.c
@@ -74,25 +74,26 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
74iDeclareType(App) 74iDeclareType(App)
75 75
76#if defined (iPlatformApple) 76#if defined (iPlatformApple)
77#define EMB_BIN "../../Resources/resources.binary" 77#define EMB_BIN "../../Resources/resources.lgr"
78static const char *dataDir_App_ = "~/Library/Application Support/fi.skyjake.Lagrange"; 78static const char *dataDir_App_ = "~/Library/Application Support/fi.skyjake.Lagrange";
79#endif 79#endif
80#if defined (iPlatformMsys) 80#if defined (iPlatformMsys)
81#define EMB_BIN "../resources.binary" 81#define EMB_BIN "../resources.lgr"
82static const char *dataDir_App_ = "~/AppData/Roaming/fi.skyjake.Lagrange"; 82static const char *dataDir_App_ = "~/AppData/Roaming/fi.skyjake.Lagrange";
83#endif 83#endif
84#if defined (iPlatformLinux) || defined (iPlatformOther) 84#if defined (iPlatformLinux) || defined (iPlatformOther)
85#define EMB_BIN "../../share/lagrange/resources.binary" 85#define EMB_BIN "../../share/lagrange/resources.lgr"
86static const char *dataDir_App_ = "~/.config/lagrange"; 86static const char *dataDir_App_ = "~/.config/lagrange";
87#endif 87#endif
88#if defined (LAGRANGE_EMB_BIN) /* specified in build config */ 88#if defined (LAGRANGE_EMB_BIN) /* specified in build config */
89# undef EMB_BIN 89# undef EMB_BIN
90# define EMB_BIN LAGRANGE_EMB_BIN 90# define EMB_BIN LAGRANGE_EMB_BIN
91#endif 91#endif
92#define EMB_BIN2 "../resources.binary" /* fallback from build/executable dir */ 92#define EMB_BIN2 "../resources.lgr" /* fallback from build/executable dir */
93static const char *prefsFileName_App_ = "prefs.cfg"; 93static const char *prefsFileName_App_ = "prefs.cfg";
94static const char *stateFileName_App_ = "state.binary"; 94static const char *oldStateFileName_App_ = "state.binary";
95static const char *downloadDir_App_ = "~/Downloads"; 95static const char *stateFileName_App_ = "state.lgr";
96static const char *downloadDir_App_ = "~/Downloads";
96 97
97static const int idleThreshold_App_ = 1000; /* ms */ 98static const int idleThreshold_App_ = 1000; /* ms */
98 99
@@ -265,7 +266,9 @@ static const char *magicTabDocument_App_ = "tabd";
265 266
266static iBool loadState_App_(iApp *d) { 267static iBool loadState_App_(iApp *d) {
267 iUnused(d); 268 iUnused(d);
268 iFile *f = iClob(newCStr_File(concatPath_CStr(dataDir_App_, stateFileName_App_))); 269 const char *oldPath = concatPath_CStr(dataDir_App_, oldStateFileName_App_);
270 const char *path = concatPath_CStr(dataDir_App_, stateFileName_App_);
271 iFile *f = iClob(newCStr_File(fileExistsCStr_FileInfo(path) ? path : oldPath));
269 if (open_File(f, readOnly_FileMode)) { 272 if (open_File(f, readOnly_FileMode)) {
270 char magic[4]; 273 char magic[4];
271 readData_File(f, 4, magic); 274 readData_File(f, 4, magic);
diff --git a/src/gmcerts.c b/src/gmcerts.c
index 0a5638fa..da918279 100644
--- a/src/gmcerts.c
+++ b/src/gmcerts.c
@@ -34,9 +34,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
34#include <the_Foundation/time.h> 34#include <the_Foundation/time.h>
35#include <ctype.h> 35#include <ctype.h>
36 36
37static const char *filename_GmCerts_ = "trusted.txt"; 37static const char *filename_GmCerts_ = "trusted.txt";
38static const char *identsDir_GmCerts_ = "idents"; 38static const char *identsDir_GmCerts_ = "idents";
39static const char *identsFilename_GmCerts_ = "idents.binary"; 39static const char *oldIdentsFilename_GmCerts_ = "idents.binary";
40static const char *identsFilename_GmCerts_ = "idents.lgr";
40 41
41iDeclareClass(TrustEntry) 42iDeclareClass(TrustEntry)
42 43
@@ -237,8 +238,9 @@ static void save_GmCerts_(const iGmCerts *d) {
237} 238}
238 239
239static void loadIdentities_GmCerts_(iGmCerts *d) { 240static void loadIdentities_GmCerts_(iGmCerts *d) {
240 iFile *f = 241 const iString *oldPath = collect_String(concatCStr_Path(&d->saveDir, oldIdentsFilename_GmCerts_));
241 iClob(new_File(collect_String(concatCStr_Path(&d->saveDir, identsFilename_GmCerts_)))); 242 const iString *path = collect_String(concatCStr_Path(&d->saveDir, identsFilename_GmCerts_));
243 iFile *f = iClob(new_File(fileExists_FileInfo(path) ? path : oldPath));
242 if (open_File(f, readOnly_FileMode)) { 244 if (open_File(f, readOnly_FileMode)) {
243 char magic[4]; 245 char magic[4];
244 readData_File(f, sizeof(magic), magic); 246 readData_File(f, sizeof(magic), magic);