mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 08:23:34 +00:00
Always pass recursive option to capacitor fs mkdir
This commit is contained in:
2 files changed
+7
-8
No files matched your search
@@ -173,7 +173,7 @@ describe('CapacitorFSAdapter', () => {
|
||||
expect(Filesystem.Filesystem.mkdir).toHaveBeenCalledWith({
|
||||
path: 'test',
|
||||
directory: 'DATA',
|
||||
recursive: false,
|
||||
recursive: true,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -162,21 +162,20 @@ export class CapacitorFSAdapter implements JSRuntimeFS {
|
||||
/**
|
||||
* Create directory
|
||||
*/
|
||||
async mkdir(path: string, options?: { recursive?: boolean }): Promise<void> {
|
||||
async mkdir(path: string): Promise<void> {
|
||||
try {
|
||||
await Filesystem.mkdir({
|
||||
path: this.normalizePath(path),
|
||||
directory: this.baseDirectory,
|
||||
recursive: options?.recursive ?? false,
|
||||
recursive: true,
|
||||
});
|
||||
} catch (error) {
|
||||
// Ignore "directory exists" errors when recursive is true
|
||||
if (options?.recursive && error instanceof Error) {
|
||||
if (error.message.includes('exists') || error.message.includes('EEXIST')) {
|
||||
return;
|
||||
}
|
||||
if (error instanceof Error && (error.message.includes('exists') || error.message.includes('EEXIST'))) {
|
||||
return;
|
||||
} else {
|
||||
throw error;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user