Skip to content

Add default output path for --compile (-c)#1472

Merged
bakpakin merged 1 commit into
janet-lang:masterfrom
Andriamanitra:compile-default-output-file
Jul 8, 2024
Merged

Add default output path for --compile (-c)#1472
bakpakin merged 1 commit into
janet-lang:masterfrom
Andriamanitra:compile-default-output-file

Conversation

@Andriamanitra
Copy link
Copy Markdown
Contributor

@Andriamanitra Andriamanitra commented Jul 8, 2024

Changes behavior of -c flag such that:

  • janet -c foo.janet writes to foo.jimage
  • janet -c foo writes to foo.jimage

Previously these would cause a confusing error due to out of bounds access to the args array (see #1451).

The default is only used if there are no more arguments after the input file – I didn't add any special handling for edge cases like janet -c foo.janet -h (which uses '-h' as the output file).

closes #1451

@sogaiu
Copy link
Copy Markdown
Contributor

sogaiu commented Jul 8, 2024

Gave the changes a try.

Both invocations seemed to work 👍

When a file named foo did not exist I got an error like:

error: could not find file foo
  in dofile [boot.janet] on line 2966, column 5
  in c-switch [boot.janet] (tail call) on line 4477, column 19
  in cli-main [boot.janet] on line 4520, column 13

which seemed helpful.

@bakpakin bakpakin merged commit 31f0ff0 into janet-lang:master Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

janet -c source with missing output files should give informative error message

3 participants