fsplc and fsplmod use rooted paths to identify things

Remedies #71
This commit is contained in:
Sasha Koshka 2024-03-26 02:07:27 -04:00
parent 48fa712cb7
commit b9e0b3265e
2 changed files with 7 additions and 1 deletions

View File

@ -46,6 +46,9 @@ func main () {
}
dir := cli.Args[0]
if abs, err := filepath.Abs(dir); err == nil {
dir = abs
}
_, err := os.Stat(dir)
if err != nil {
err := os.Mkdir(dir, 0755)
@ -79,6 +82,9 @@ func main () {
}
dir := cli.Args[0]
if abs, err := filepath.Abs(dir); err == nil {
dir = abs
}
metadataPath := filepath.Join(dir, "fspl.mod")
file, err := os.OpenFile(metadataPath, os.O_RDWR, 0644)
handleErr(cli, err, 1)

View File

@ -40,7 +40,7 @@ func (this *Compiler) CompileUnit (address entity.Address) error {
// if the output file is unspecified, generate a nickname from the
// input address. if that doesn't work, default to "output"
if this.Output == "" {
nickname, ok := address.Nickname()
nickname, ok := entity.Address(path).Nickname()
if !ok { nickname = "output" }
this.Output = this.Filetype.Extend(nickname)
}