@tokamakdev/platform-ios-arm64 0.1.1-beta.51 → 0.1.1-beta.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -22,7 +22,8 @@ typedef struct {
|
|
|
22
22
|
} TokamakIdentity;
|
|
23
23
|
|
|
24
24
|
void *tokamak_runtime_start(const char *packaged_dir, const char *state_dir,
|
|
25
|
-
|
|
25
|
+
const char *storage_dir, const char *host,
|
|
26
|
+
char *error, size_t error_len);
|
|
26
27
|
void *tokamak_runtime_start_development(const char *state_dir, const char *host,
|
|
27
28
|
const char *endpoint,
|
|
28
29
|
const char *session_token, char *error,
|
|
Binary file
|
|
@@ -182,17 +182,21 @@ final class RuntimeHandle {
|
|
|
182
182
|
guard let bundle else {
|
|
183
183
|
throw RuntimeError.configuration("app bundle resources are unavailable")
|
|
184
184
|
}
|
|
185
|
+
let storage = try Self.storageDirectory()
|
|
185
186
|
handle = bundle.path.withCString { bundlePath in
|
|
186
187
|
state.path.withCString { statePath in
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
188
|
+
storage.path.withCString { storagePath in
|
|
189
|
+
appHost.withCString { appHost in
|
|
190
|
+
error.withUnsafeMutableBufferPointer { error in
|
|
191
|
+
tokamak_runtime_start(
|
|
192
|
+
bundlePath,
|
|
193
|
+
statePath,
|
|
194
|
+
storagePath,
|
|
195
|
+
appHost,
|
|
196
|
+
error.baseAddress,
|
|
197
|
+
error.count
|
|
198
|
+
)
|
|
199
|
+
}
|
|
196
200
|
}
|
|
197
201
|
}
|
|
198
202
|
}
|
|
@@ -332,21 +336,31 @@ final class RuntimeHandle {
|
|
|
332
336
|
)
|
|
333
337
|
}
|
|
334
338
|
|
|
339
|
+
/// Stores behind storage bindings, which device backups include.
|
|
340
|
+
private static func storageDirectory() throws -> URL {
|
|
341
|
+
let storage = try appDirectory(.applicationSupportDirectory)
|
|
342
|
+
.appendingPathComponent("tokamak/storage", isDirectory: true)
|
|
343
|
+
try FileManager.default.createDirectory(at: storage, withIntermediateDirectories: true)
|
|
344
|
+
return storage
|
|
345
|
+
}
|
|
346
|
+
|
|
335
347
|
private static func stateDirectory() throws -> URL {
|
|
348
|
+
let state = try appDirectory(.cachesDirectory)
|
|
349
|
+
try FileManager.default.createDirectory(at: state, withIntermediateDirectories: true)
|
|
350
|
+
return state
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
/// This app's folder in the user's `directory`.
|
|
354
|
+
private static func appDirectory(_ directory: FileManager.SearchPathDirectory) throws -> URL {
|
|
336
355
|
guard let identifier = Bundle.main.bundleIdentifier else {
|
|
337
356
|
throw RuntimeError.configuration("CFBundleIdentifier is required")
|
|
338
357
|
}
|
|
339
|
-
|
|
340
|
-
for:
|
|
358
|
+
return try FileManager.default.url(
|
|
359
|
+
for: directory,
|
|
341
360
|
in: .userDomainMask,
|
|
342
361
|
appropriateFor: nil,
|
|
343
362
|
create: true
|
|
344
363
|
)
|
|
345
|
-
|
|
346
|
-
try FileManager.default.createDirectory(
|
|
347
|
-
at: state,
|
|
348
|
-
withIntermediateDirectories: true
|
|
349
|
-
)
|
|
350
|
-
return state
|
|
364
|
+
.appendingPathComponent(identifier, isDirectory: true)
|
|
351
365
|
}
|
|
352
366
|
}
|