refactor: circular deps part 15

This commit is contained in:
Nathan Walker
2025-07-11 16:18:14 -07:00
parent e7ab426ee2
commit 35fef40e5b
18 changed files with 697 additions and 690 deletions

View File

@@ -1,5 +1,6 @@
import * as textModule from '../text';
import { getFileExtension, android as androidUtils } from '../utils';
import { android as androidUtils } from '../utils';
import { getFileExtension } from '../utils/utils-shared';
import { SDK_VERSION } from '../utils/constants';
import type { IFileSystemAccess } from './file-system-access';

View File

@@ -1,5 +1,6 @@
import { encoding as textEncoding } from '../text';
import { ios as iosUtils } from '../utils';
import { getFileExtension } from '../utils/utils-shared';
// TODO: Implement all the APIs receiving callback using async blocks
// TODO: Check whether we need try/catch blocks for the iOS implementation
@@ -611,24 +612,8 @@ export class FileSystemAccess {
return url.path;
}
// TODO: This method is the same as in the iOS implementation.
// Make it in a separate file / module so it can be reused from both implementations.
public getFileExtension(path: string): string {
// TODO [For Panata]: The definitions currently specify "any" as a return value of this method
//const nsString = Foundation.NSString.stringWithString(path);
//const extension = nsString.pathExtension();
//if (extension && extension.length > 0) {
// extension = extension.concat(".", extension);
//}
//return extension;
const dotIndex = path.lastIndexOf('.');
if (dotIndex && dotIndex >= 0 && dotIndex < path.length) {
return path.substring(dotIndex);
}
return '';
return getFileExtension(path);
}
private deleteEntity(path: string, onError?: (error: any) => any) {