mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
fix paths
This commit is contained in:
@@ -22,7 +22,11 @@ struct SimpleXApp: App {
|
||||
|
||||
init() {
|
||||
DispatchQueue.global(qos: .background).sync {
|
||||
haskell_init(getAppEventLogPath().path, getAppDebugProfilePath().path)
|
||||
// we have to use debug profile file name without extension here because .hp extension is added by profiler
|
||||
haskell_init(
|
||||
getAppEventLogPath().path,
|
||||
getAppDebugProfilePrefixPath().path
|
||||
)
|
||||
// hs_init(0, nil)
|
||||
}
|
||||
UserDefaults.standard.register(defaults: appDefaults)
|
||||
|
||||
@@ -52,6 +52,10 @@ func getAppDirectory() -> URL {
|
||||
|
||||
let DB_FILE_PREFIX = "simplex_v1"
|
||||
|
||||
let DEBUG_PROFILE_PREFIX = "simplex_debug"
|
||||
|
||||
let DEBUG_PROFILE_EXTENSION = ".hp"
|
||||
|
||||
func getLegacyDatabasePath() -> URL {
|
||||
getDocumentsDirectory().appendingPathComponent("mobile_v1", isDirectory: false)
|
||||
}
|
||||
@@ -62,6 +66,18 @@ public func getAppDatabasePath() -> URL {
|
||||
: getLegacyDatabasePath()
|
||||
}
|
||||
|
||||
public func getAppDebugProfilePrefixPath() -> URL {
|
||||
getAppDirectory().appendingPathComponent(DEBUG_PROFILE_PREFIX, isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppDebugProfilePath() -> URL {
|
||||
getAppDirectory().appendingPathComponent(DEBUG_PROFILE_PREFIX + DEBUG_PROFILE_EXTENSION, isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppEventLogPath() -> URL {
|
||||
getAppDirectory().appendingPathComponent("simplex.eventlog", isDirectory: false)
|
||||
}
|
||||
|
||||
func fileModificationDate(_ path: String) -> Date? {
|
||||
do {
|
||||
let attr = try FileManager.default.attributesOfItem(atPath: path)
|
||||
@@ -192,14 +208,6 @@ public func getAppFilesDirectory() -> URL {
|
||||
getAppDirectory().appendingPathComponent("app_files", isDirectory: true)
|
||||
}
|
||||
|
||||
public func getAppDebugProfilePath() -> URL {
|
||||
getAppDirectory().appendingPathComponent("simplex_debug_profile", isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppEventLogPath() -> URL {
|
||||
getAppDirectory().appendingPathComponent("simplex_event_log", isDirectory: false)
|
||||
}
|
||||
|
||||
public func getAppFilePath(_ fileName: String) -> URL {
|
||||
getAppFilesDirectory().appendingPathComponent(fileName)
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#include "hs_init.h"
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
extern void hs_init_with_rtsopts(int * argc, char **argv[]);
|
||||
@@ -25,13 +26,14 @@ void haskell_init(const char *eventlog, const char *heap_profile) {
|
||||
if (eventlog) {
|
||||
static char ol[1024] = "-ol";
|
||||
(void)strncpy(&ol[3], eventlog, sizeof(ol) - 3);
|
||||
argv[argc++] = "-olsimplex.eventlog"; // produce <eventlog> file relative to "current" directory
|
||||
printf("%s\n", ol);
|
||||
argv[argc++] = ol;
|
||||
argv[argc++] = "-l-agu"; // collect GC and user events
|
||||
}
|
||||
if (heap_profile) {
|
||||
static char po[1024] = "-po";
|
||||
(void)strncpy(&po[3], heap_profile, sizeof(po) - 3);
|
||||
argv[argc++] = po; // produce <heap_profile>.hp relative to "current" directory
|
||||
argv[argc++] = po; // adds ".hp" extension
|
||||
argv[argc++] = "-hT"; // emit heap profile by closure type
|
||||
}
|
||||
int non_moving_gc = !heap_profile; // not compatible with heap profile
|
||||
|
||||
Reference in New Issue
Block a user