Skip to content

Commit

Permalink
Support files in nested folders
Browse files Browse the repository at this point in the history
  • Loading branch information
dusty-phillips committed Aug 27, 2024
1 parent 449dbf3 commit 4dfffa5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/compiler/program.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import gleam/list
import gleam/option
import gleam/result
import gleam/set
import gleam/string
import simplifile

pub type GleamProgram {
Expand Down Expand Up @@ -150,7 +151,7 @@ fn identify_python_external_attribute(
glance.Attribute(
"external",
[glance.Variable("python"), glance.String(module), ..],
) -> Ok(module <> ".py")
) -> Ok(string.replace(module, ".", "/") <> ".py")
_ -> Error(Nil)
}
}
4 changes: 3 additions & 1 deletion src/output.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ pub fn copy_externals(
Ok(Nil) -> {
let src = filepath.join(source_directory, file)
let dst = filepath.join(build_directory, file)
simplifile.copy_file(src, dst)
let dst_dir = filepath.directory_name(dst)
simplifile.create_directory_all(dst_dir)
|> result.try(fn(__main__) { simplifile.copy_file(src, dst) })
|> result.map_error(errors.CopyFileError(src, dst, _))
}
Error(error) -> Error(error)
Expand Down

0 comments on commit 4dfffa5

Please sign in to comment.