xray16 1.5.1 → 1.5.2

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "xray16",
3
- "version": "1.5.1",
3
+ "version": "1.5.2",
4
4
  "author": "Neloreck",
5
5
  "repository": "https://github.com/xray-forge/xray-16-types",
6
6
  "private": false,
@@ -180,6 +180,68 @@ declare module "xray16" {
180
180
  private constructor();
181
181
  }
182
182
 
183
+ /**
184
+ * Registered filesystem path alias descriptor.
185
+ *
186
+ * @source C++ class FS_Path
187
+ * @customConstructor FS_Path
188
+ * @group xr_fs
189
+ *
190
+ * @remarks
191
+ * Returned by filesystem alias lookups. The object is owned by the engine filesystem. Missing aliases assert in
192
+ * the single-argument `get_path` binding instead of returning `null`.
193
+ */
194
+ export class FS_Path {
195
+ /**
196
+ * Resolved full path.
197
+ */
198
+ public readonly m_Path: string;
199
+
200
+ /**
201
+ * Root path used by this alias.
202
+ */
203
+ public readonly m_Root: string;
204
+
205
+ /**
206
+ * Relative path segment added to the root.
207
+ */
208
+ public readonly m_Add: string;
209
+
210
+ /**
211
+ * Default extension used by this alias.
212
+ */
213
+ public readonly m_DefExt: string;
214
+
215
+ /**
216
+ * File dialog filter caption.
217
+ */
218
+ public readonly m_FilterCaption: string;
219
+
220
+ /**
221
+ * Engine-created path descriptor.
222
+ */
223
+ private constructor();
224
+ }
225
+
226
+ /**
227
+ * Opaque filesystem writer handle.
228
+ *
229
+ * @source C++ class IWriter
230
+ * @customConstructor IWriter
231
+ * @group xr_fs
232
+ *
233
+ * @remarks
234
+ * Returned by {@link FS.w_open}. The writer class is not registered with script-callable write methods in this
235
+ * binding, so scripts normally only pass it back to {@link FS.w_close}. Writer creation can return `null` when
236
+ * native writer setup fails.
237
+ */
238
+ export class IWriter {
239
+ /**
240
+ * Engine-created writer handle.
241
+ */
242
+ private constructor();
243
+ }
244
+
183
245
  /**
184
246
  * Engine filesystem facade.
185
247
  *
@@ -410,18 +472,22 @@ declare module "xray16" {
410
472
  * @param fs_type - Filesystem source to search.
411
473
  * @returns File status.
412
474
  */
413
- public exist(path: string, fs_type: TXR_fs_type): FileStatus;
475
+ public exist(path: string, fs_type: TXR_fs_type): FileStatus | null;
414
476
 
415
477
  /**
416
478
  * Add a path alias.
417
479
  *
480
+ * @remarks
481
+ * Native code asserts if `root` is invalid or `alias` is already registered. On success it returns a path
482
+ * descriptor.
483
+ *
418
484
  * @param alias - Alias name.
419
485
  * @param root - Root path.
420
486
  * @param path - Relative path.
421
487
  * @param recursive - Whether subfolders should be scanned.
422
488
  * @returns Native filesystem path descriptor.
423
489
  */
424
- public append_path(alias: string, root: string, path: string, recursive: boolean): unknown; /* FS_Path */
490
+ public append_path(alias: string, root: string, path: string, recursive: boolean): FS_Path;
425
491
 
426
492
  /**
427
493
  * Check whether a path alias exists.
@@ -458,10 +524,14 @@ declare module "xray16" {
458
524
  /**
459
525
  * Get native path descriptor for an alias.
460
526
  *
527
+ * @remarks
528
+ * Native code asserts when the alias is missing. Use {@link FS.path_exist} before calling when the alias is
529
+ * optional.
530
+ *
461
531
  * @param alias - Filesystem path alias.
462
532
  * @returns Native filesystem path descriptor.
463
533
  */
464
- public get_path(alias: string): unknown;
534
+ public get_path(alias: string): FS_Path;
465
535
 
466
536
  /**
467
537
  * Close a binary reader.
@@ -492,24 +562,30 @@ declare module "xray16" {
492
562
  *
493
563
  * @param writer - Writer returned by `w_open`.
494
564
  */
495
- public w_close(writer: unknown /* IWriter */): void;
565
+ public w_close(writer: IWriter | null): void;
496
566
 
497
567
  /**
498
568
  * Open a binary writer below a path alias.
499
569
  *
570
+ * @remarks
571
+ * Can return `null` when native writer setup fails.
572
+ *
500
573
  * @param path - Filesystem path alias.
501
574
  * @param filename - Relative file path.
502
- * @returns Binary writer.
575
+ * @returns Binary writer, or `null`.
503
576
  */
504
- public w_open(path: string, filename: string): unknown; /* IWriter */
577
+ public w_open(path: string, filename: string): IWriter | null;
505
578
 
506
579
  /**
507
580
  * Open a binary writer.
508
581
  *
582
+ * @remarks
583
+ * Can return `null` when native writer setup fails.
584
+ *
509
585
  * @param path - File path.
510
- * @returns Binary writer.
586
+ * @returns Binary writer, or `null`.
511
587
  */
512
- public w_open(path: string): unknown; /* IWriter */
588
+ public w_open(path: string): IWriter | null;
513
589
  }
514
590
 
515
591
  /**