aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorAkseli Lahtinen <akselmo@akselmo.dev>2025-04-05 18:13:19 +0300
committerAkseli Lahtinen <akselmo@akselmo.dev>2025-04-05 18:21:20 +0300
commitdc72ed8137ece14ae9a1a9f274a5c53ddf8c7ca0 (patch)
tree3ac4eb2303c6c51f032bfa26775e861866e04bcd /tools
parent1e44e3d78ad8a74ef09c7f54a6f6d3f7df517f8e (diff)
Check for path length
Diffstat (limited to 'tools')
-rw-r--r--tools/odinfmt/main.odin5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/odinfmt/main.odin b/tools/odinfmt/main.odin
index a912001..a829be6 100644
--- a/tools/odinfmt/main.odin
+++ b/tools/odinfmt/main.odin
@@ -90,6 +90,9 @@ main :: proc() {
path := os.args[len(os.args) - 1]
if strings.has_prefix(os.args[len(os.args) - 1], "-") {
args_to_parse = os.args[1:]
+ }
+
+ if len(path) <= 1 {
path = "." // if no file was specified, use current directory as the starting path to look for `odinfmt.json`
}
@@ -186,4 +189,4 @@ main :: proc() {
}
os.exit(1 if write_failure else 0)
-}
+} \ No newline at end of file