@tokamakdev/platform-macos-arm64 0.1.1-beta.51 → 0.1.1-beta.52

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
- const char *host, char *error, size_t error_len);
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,
@@ -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
- appHost.withCString { appHost in
188
- error.withUnsafeMutableBufferPointer { error in
189
- tokamak_runtime_start(
190
- bundlePath,
191
- statePath,
192
- appHost,
193
- error.baseAddress,
194
- error.count
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
- let root = try FileManager.default.url(
340
- for: .cachesDirectory,
358
+ return try FileManager.default.url(
359
+ for: directory,
341
360
  in: .userDomainMask,
342
361
  appropriateFor: nil,
343
362
  create: true
344
363
  )
345
- let state = root.appendingPathComponent(identifier, isDirectory: true)
346
- try FileManager.default.createDirectory(
347
- at: state,
348
- withIntermediateDirectories: true
349
- )
350
- return state
364
+ .appendingPathComponent(identifier, isDirectory: true)
351
365
  }
352
366
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokamakdev/platform-macos-arm64",
3
- "version": "0.1.1-beta.51",
3
+ "version": "0.1.1-beta.52",
4
4
  "description": "The tokamak platform pack for macos-arm64",
5
5
  "repository": {
6
6
  "type": "git",