diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-23 14:30:12 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-08-23 14:30:12 +0300 |
commit | 3b31ab31eb52578693acee07fdcf84fbeff72707 (patch) | |
tree | 954933c8f2db93aebe855a9a2d3baed3ae48a8a8 | |
parent | 863adf9118ae98a42bbbbd556087a437aba62329 (diff) |
Cleanup: Use ".binary" for binary files
-rw-r--r-- | CMakeLists.txt | 4 | ||||
-rw-r--r-- | Embed.cmake | 4 | ||||
-rw-r--r-- | src/app.c | 16 | ||||
-rw-r--r-- | src/gmcerts.c | 4 | ||||
-rw-r--r-- | src/ui/macos.m | 4 |
5 files changed, 16 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c5b89fc..5465ae58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -34,12 +34,12 @@ set (EMBED_RESOURCES | |||
34 | endif () | 34 | endif () |
35 | embed_make (${EMBED_RESOURCES}) | 35 | embed_make (${EMBED_RESOURCES}) |
36 | 36 | ||
37 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.bin) | 37 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary) |
38 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) | 38 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) |
39 | 39 | ||
40 | # Source files. | 40 | # Source files. |
41 | set (SOURCES | 41 | set (SOURCES |
42 | ${CMAKE_CURRENT_BINARY_DIR}/resources.bin | 42 | ${CMAKE_CURRENT_BINARY_DIR}/resources.binary |
43 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.c | 43 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.c |
44 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.h | 44 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.h |
45 | src/main.c | 45 | src/main.c |
diff --git a/Embed.cmake b/Embed.cmake index ce2c5ff8..242002f0 100644 --- a/Embed.cmake +++ b/Embed.cmake | |||
@@ -4,7 +4,7 @@ | |||
4 | 4 | ||
5 | option (EMBED_IN_EXECUTABLE "Embed resources inside the executable" OFF) | 5 | option (EMBED_IN_EXECUTABLE "Embed resources inside the executable" OFF) |
6 | # Note: If disabled, the Unix "cat" tool is required for concatenating | 6 | # Note: If disabled, the Unix "cat" tool is required for concatenating |
7 | # the resources into a single "resources.bin" file. | 7 | # the resources into a single "resources.binary" file. |
8 | 8 | ||
9 | function (embed_getname output fn) | 9 | function (embed_getname output fn) |
10 | get_filename_component (name ${fn} NAME_WE) | 10 | get_filename_component (name ${fn} NAME_WE) |
@@ -78,7 +78,7 @@ function (embed_make) | |||
78 | endforeach (fn) | 78 | endforeach (fn) |
79 | else () | 79 | else () |
80 | # Collect resources in a single binary file. | 80 | # Collect resources in a single binary file. |
81 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.bin) | 81 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary) |
82 | file (REMOVE ${EMB_BIN}) | 82 | file (REMOVE ${EMB_BIN}) |
83 | execute_process (COMMAND cat ${ARGV} OUTPUT_FILE ${EMB_BIN} | 83 | execute_process (COMMAND cat ${ARGV} OUTPUT_FILE ${EMB_BIN} |
84 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) | 84 | WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) |
@@ -60,20 +60,20 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
60 | iDeclareType(App) | 60 | iDeclareType(App) |
61 | 61 | ||
62 | #if defined (iPlatformApple) | 62 | #if defined (iPlatformApple) |
63 | #define EMB_BIN "../../Resources/resources.bin" | 63 | #define EMB_BIN "../../Resources/resources.binary" |
64 | static const char *dataDir_App_ = "~/Library/Application Support/fi.skyjake.Lagrange"; | 64 | static const char *dataDir_App_ = "~/Library/Application Support/fi.skyjake.Lagrange"; |
65 | #endif | 65 | #endif |
66 | #if defined (iPlatformMsys) | 66 | #if defined (iPlatformMsys) |
67 | #define EMB_BIN "../resources.bin" | 67 | #define EMB_BIN "../resources.binary" |
68 | static const char *dataDir_App_ = "~/AppData/Roaming/fi.skyjake.Lagrange"; | 68 | static const char *dataDir_App_ = "~/AppData/Roaming/fi.skyjake.Lagrange"; |
69 | #endif | 69 | #endif |
70 | #if defined (iPlatformLinux) | 70 | #if defined (iPlatformLinux) |
71 | #define EMB_BIN "../../share/lagrange/resources.bin" | 71 | #define EMB_BIN "../../share/lagrange/resources.binary" |
72 | #define EMB_BIN2 "../resources.bin" /* try from build dir as well */ | ||
73 | static const char *dataDir_App_ = "~/.config/lagrange"; | 72 | static const char *dataDir_App_ = "~/.config/lagrange"; |
74 | #endif | 73 | #endif |
74 | #define EMB_BIN2 "../resources.binary" /* fallback from build/executable dir */ | ||
75 | static const char *prefsFileName_App_ = "prefs.cfg"; | 75 | static const char *prefsFileName_App_ = "prefs.cfg"; |
76 | static const char *stateFileName_App_ = "state.bin"; | 76 | static const char *stateFileName_App_ = "state.binary"; |
77 | 77 | ||
78 | struct Impl_App { | 78 | struct Impl_App { |
79 | iCommandLine args; | 79 | iCommandLine args; |
@@ -274,9 +274,9 @@ static void init_App_(iApp *d, int argc, char **argv) { | |||
274 | load_Bookmarks(d->bookmarks, dataDir_App_); | 274 | load_Bookmarks(d->bookmarks, dataDir_App_); |
275 | #if defined (iHaveLoadEmbed) | 275 | #if defined (iHaveLoadEmbed) |
276 | /* Load the resources from a file. */ { | 276 | /* Load the resources from a file. */ { |
277 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), "../resources.bin"))) { | 277 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) { |
278 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN))) { | 278 | if (!load_Embed(concatPath_CStr(cstr_String(execPath_App()), EMB_BIN2))) { |
279 | fprintf(stderr, "failed to load resources.bin: %s\n", strerror(errno)); | 279 | fprintf(stderr, "failed to load resources: %s\n", strerror(errno)); |
280 | exit(-1); | 280 | exit(-1); |
281 | } | 281 | } |
282 | } | 282 | } |
diff --git a/src/gmcerts.c b/src/gmcerts.c index 58ddfd0c..cc7e9702 100644 --- a/src/gmcerts.c +++ b/src/gmcerts.c | |||
@@ -35,7 +35,7 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ | |||
35 | 35 | ||
36 | static const char *filename_GmCerts_ = "trusted.txt"; | 36 | static const char *filename_GmCerts_ = "trusted.txt"; |
37 | static const char *identsDir_GmCerts_ = "idents"; | 37 | static const char *identsDir_GmCerts_ = "idents"; |
38 | static const char *identsFilename_GmCerts_ = "idents.bin"; | 38 | static const char *identsFilename_GmCerts_ = "idents.binary"; |
39 | 39 | ||
40 | iDeclareClass(TrustEntry) | 40 | iDeclareClass(TrustEntry) |
41 | 41 | ||
@@ -197,7 +197,6 @@ static void save_GmCerts_(const iGmCerts *d) { | |||
197 | deinit_String(&line); | 197 | deinit_String(&line); |
198 | } | 198 | } |
199 | iRelease(f); | 199 | iRelease(f); |
200 | saveIdentities_GmCerts_(d); | ||
201 | iEndCollect(); | 200 | iEndCollect(); |
202 | } | 201 | } |
203 | 202 | ||
@@ -317,6 +316,7 @@ void init_GmCerts(iGmCerts *d, const char *saveDir) { | |||
317 | 316 | ||
318 | void deinit_GmCerts(iGmCerts *d) { | 317 | void deinit_GmCerts(iGmCerts *d) { |
319 | iGuardMutex(&d->mtx, { | 318 | iGuardMutex(&d->mtx, { |
319 | saveIdentities_GmCerts_(d); | ||
320 | iForEach(PtrArray, i, &d->idents) { | 320 | iForEach(PtrArray, i, &d->idents) { |
321 | delete_GmIdentity(i.ptr); | 321 | delete_GmIdentity(i.ptr); |
322 | } | 322 | } |
diff --git a/src/ui/macos.m b/src/ui/macos.m index 2cb43eae..0e4927ee 100644 --- a/src/ui/macos.m +++ b/src/ui/macos.m | |||
@@ -150,8 +150,8 @@ static void appearanceChanged_MacOS_(NSString *name) { | |||
150 | const iBool isDark = [name containsString:@"Dark"]; | 150 | const iBool isDark = [name containsString:@"Dark"]; |
151 | const iBool isHighContrast = [name containsString:@"HighContrast"]; | 151 | const iBool isHighContrast = [name containsString:@"HighContrast"]; |
152 | postCommandf_App("os.theme.changed dark:%d contrast:%d", isDark ? 1 : 0, isHighContrast ? 1 : 0); | 152 | postCommandf_App("os.theme.changed dark:%d contrast:%d", isDark ? 1 : 0, isHighContrast ? 1 : 0); |
153 | printf("Effective appearance changed: %s\n", [name cStringUsingEncoding:NSUTF8StringEncoding]); | 153 | // printf("Effective appearance changed: %s\n", [name cStringUsingEncoding:NSUTF8StringEncoding]); |
154 | fflush(stdout); | 154 | // fflush(stdout); |
155 | } | 155 | } |
156 | 156 | ||
157 | - (void)setAppearance:(NSString *)name { | 157 | - (void)setAppearance:(NSString *)name { |