mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Make creation of symlinks not fail when parent directory does not exist
Co-authored-by: Mikko Aspiala <mikko.aspiala@gmail.com> Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
parent
96ce667cbd
commit
603afc19a7
@ -1,9 +1,15 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import fse from "fs-extra";
|
||||
import { dirname } from "path";
|
||||
|
||||
export type CreateSymlink = (target: string, path: string, type: "dir" | "file") => Promise<void>;
|
||||
|
||||
export const createSymlinkInjectable = getInjectable({
|
||||
id: "create-symlink",
|
||||
instantiate: (): CreateSymlink => fse.symlink,
|
||||
|
||||
instantiate: (): CreateSymlink => async (target, path, type) => {
|
||||
await fse.ensureDir(dirname(path));
|
||||
|
||||
return fse.symlink(target, path, type);
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user