cross platform expandHomePath
This commit is contained in:
1 parent
95419a5e51
commit
be526df88a
1 file changed
+3
-3
@@ -60,10 +60,10 @@ const CliEnvConfig = Config.all({
|
||||
});
|
||||
|
||||
const expandHomePath = Effect.fn(function* (input: string) {
|
||||
const { join } = yield* Path.Path;
|
||||
const { join, sep } = yield* Path.Path;
|
||||
if (input === "~") return os.homedir();
|
||||
if (input.startsWith("~/")) {
|
||||
return join(os.homedir(), input.slice(2));
|
||||
if (input.startsWith(`~${sep}`)) {
|
||||
return join(os.homedir(), input.slice(sep.length));
|
||||
}
|
||||
return input;
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user