mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
refactor: circular deps part 15
This commit is contained in:
@@ -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';
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user