Closed mbpowers closed 4 months ago
I would also consider adding "/" check then. So that some like me doesn't override his root directory with melange app
Rather than this fix, and supporting nested directories, I would like to prohibit nested directories. Lets instead update this function in https://github.com/dmmulroy/create-melange-app/blob/develop/src/core/fs.ml to return a result and fail if there are invalid characters or slashes in the name here:
let parse_project_name_and_dir (str : string) =
let trimmed = trim_trailing_slash str in
if String.equal trimmed "." then
let name = [| trimmed |] |> Nodejs.Path.resolve |> Nodejs.Path.basename in
let directory = [| Nodejs.Process.cwd () |] |> Nodejs.Path.resolve in
(name, directory)
else
let name = [| trimmed |] |> Nodejs.Path.resolve |> Nodejs.Path.basename in
let directory =
[| trimmed; name |] |> Nodejs.Path.resolve |> Nodejs.Path.dirname
in
(name, directory)
;;
okay I think this should be good
when inputting a name in the cli that contains
/
, nested directories are createdfixes #98