aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Pilfold <louis@lpil.uk>2024-01-18 19:28:04 +0000
committerLouis Pilfold <louis@lpil.uk>2024-01-18 19:28:04 +0000
commitd8de92f53c9720acf461f54a49f1b87ede2cd56a (patch)
treebc4b6cbac86d8850e4a66a1d8209ae61eaa5dd6e
parent1e15f4ab689ed57980099919030c8965fe1ccffa (diff)
downloadtour-d8de92f53c9720acf461f54a49f1b87ede2cd56a.tar.gz
tour-d8de92f53c9720acf461f54a49f1b87ede2cd56a.zip
Use path library
-rw-r--r--gleam.toml1
-rw-r--r--manifest.toml2
-rw-r--r--src/tour.gleam4
3 files changed, 6 insertions, 1 deletions
diff --git a/gleam.toml b/gleam.toml
index 6435c03..bfcb32c 100644
--- a/gleam.toml
+++ b/gleam.toml
@@ -15,6 +15,7 @@ gleam_stdlib = "~> 0.32"
simplifile = "~> 1.0"
snag = "~> 0.2"
htmb = "~> 1.1"
+filepath = "~> 0.1"
[dev-dependencies]
gleeunit = "~> 1.0"
diff --git a/manifest.toml b/manifest.toml
index 98ff320..75c9ef6 100644
--- a/manifest.toml
+++ b/manifest.toml
@@ -2,6 +2,7 @@
# You typically do not need to edit this file
packages = [
+ { name = "filepath", version = "0.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "534E8161A0DE192A9A105EFEC34369E9FD5834BB58ED449B5ACAEE8704358588" },
{ name = "gleam_stdlib", version = "0.34.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "1FB8454D2991E9B4C0C804544D8A9AD0F6184725E20D63C3155F0AEB4230B016" },
{ name = "gleeunit", version = "1.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleeunit", source = "hex", outer_checksum = "D364C87AFEB26BDB4FB8A5ABDE67D635DC9FA52D6AB68416044C35B096C6882D" },
{ name = "htmb", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "htmb", source = "hex", outer_checksum = "30D448F0E15DFCF7283AAAC2F351D77B9D54E318219C9FDDB1877572B67C27B7" },
@@ -10,6 +11,7 @@ packages = [
]
[requirements]
+filepath = { version = "~> 0.1"}
gleam_stdlib = { version = "~> 0.32" }
gleeunit = { version = "~> 1.0" }
htmb = { version = "~> 1.1" }
diff --git a/src/tour.gleam b/src/tour.gleam
index 7015727..b028998 100644
--- a/src/tour.gleam
+++ b/src/tour.gleam
@@ -6,6 +6,7 @@ import gleam/option.{type Option, None, Some}
import gleam/string
import gleam/result
import simplifile
+import filepath
import snag
const static = "static"
@@ -278,7 +279,8 @@ fn write_lesson(lesson: Lesson) -> snag.Result(Nil) {
|> file_error("Failed to make " <> path),
)
- let path = path <> "/index.html"
+ let path = filepath.join(path, "/index.html")
+ io.println("writing " <> path)
simplifile.write(to: path, contents: lesson_html(lesson))
|> file_error("Failed to write page " <> path)
}