Skip to content

Commit

Permalink
Hopefully fix the hub/hub.hub thing
Browse files Browse the repository at this point in the history
  • Loading branch information
peachpit-site committed Sep 16, 2024
1 parent a553d06 commit 8cd4a84
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.vscode
pipefish
pipefish.exe
.DS_
pytool
rsc/hub/*
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module pipefish

go 1.22.5
go 1.23

require (
github.com/lmorg/readline v0.0.0-20210316231630-be4b7d79fc3a
Expand Down Expand Up @@ -77,6 +77,7 @@ require (
github.com/snowflakedb/gosnowflake v1.10.1 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b // indirect
golang.org/dl v0.0.0-20240905150950-a427666708fc // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/mod v0.19.0 // indirect
golang.org/x/net v0.27.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,8 @@ github.com/zeebo/xxh3 v1.0.2 h1:xZmwmqxHZA8AI603jOQ0tMqmBr9lPeFwGg6d+xy9DC0=
github.com/zeebo/xxh3 v1.0.2/go.mod h1:5NWz9Sef7zIDm2JHfFlcQvNekmcEl9ekUZQQKCYaDcA=
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b h1:7gd+rd8P3bqcn/96gOZa3F5dpJr/vEiDQYlNb/y2uNs=
gitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=
golang.org/dl v0.0.0-20240905150950-a427666708fc h1:8pL1jPaS3+RBsh1u9o2PSjZ3u/Sla0KqGU0LC/j/3bc=
golang.org/dl v0.0.0-20240905150950-a427666708fc/go.mod h1:fwQ+hlTD8I6TIzOGkQqxQNfE2xqR+y7SzGaDkksVFkw=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
3 changes: 1 addition & 2 deletions rsc/hub/hub.hub → hub/hub.hub
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ Database = struct(driver DatabaseDrivers, name, host string, port int, username,

var

allServices = map("hub"::"rsc/hub/hub.hub",
.. "TRACK"::"examples/track.pf")
allServices = map("hub"::"hub/hub.hub")

currentService string? = "TRACK"

Expand Down
9 changes: 3 additions & 6 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,15 @@ func main() {

h := hub.New(os.Stdin, os.Stdout)
appDir, _ := filepath.Abs(filepath.Dir(os.Args[0]))
f, err := os.Open(appDir + "/user/hubloc.dat")
f, err := os.Open(filepath.Join(appDir, filepath.FromSlash("/user/hub.dat")))
if err != nil {
h.WriteError(err.Error())
println(err.Error())
panic("That's all folks!")
}
scanner := bufio.NewScanner(f)
scanner.Scan()
scanner.Scan()
scanner.Scan()
line := scanner.Text()
fname := line[8 : len(line)-1]
h.OpenHubFile(fname)
h.OpenHubFile(line)
hub.StartHub(h, os.Stdin, os.Stdout)
}

Expand Down
2 changes: 1 addition & 1 deletion source/report/errorfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ var ErrorCreatorMap = map[string]ErrorCreator{

"init/source/a": {
Message: func(tok *token.Token, args ...any) string {
return "unable to get source " + emph(args[0])
return "unable to get source " + emph(args[0]) + " with error " + emph(args[1])
},
Explanation: func(errors Errors, pos int, tok *token.Token, args ...any) string {
return "The initializer can't retrieve the source code for the given file. Check that it exists."
Expand Down
7 changes: 4 additions & 3 deletions source/service/vmmaker.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"database/sql"
"embed"
"os"
"path/filepath"
"testing"

"pipefish/source/ast"
Expand Down Expand Up @@ -58,7 +59,7 @@ func initializeFromFilepath(mc *Vm, scriptFilepath, dir string, namespacePath st
sourcecode = string(sourcebytes) + "\n"
if err != nil {
uP := NewInitializer(scriptFilepath, sourcecode, dir, namespacePath) // Just because it's expecting to find errors in the uP.
uP.Throw("init/source/a", token.Token{Source: "linking"}, scriptFilepath)
uP.Throw("init/source/a", token.Token{Source: "linking"}, scriptFilepath, err.Error())
return nil, uP
}
}
Expand Down Expand Up @@ -1365,8 +1366,8 @@ func altType(t ...values.ValueType) AlternateType {

func MakeFilepath(scriptFilepath, dir string) string {
doctoredFilepath := strings.Clone(scriptFilepath)
if len(scriptFilepath) >= 4 && scriptFilepath[0:4] == "rsc/" {
doctoredFilepath = dir + scriptFilepath
if len(scriptFilepath) >= 4 && scriptFilepath[0:4] == "rsc/" || scriptFilepath[0:4] == "hub/" {
doctoredFilepath = filepath.Join(dir, filepath.FromSlash(scriptFilepath))
}
if settings.StandardLibraries.Contains(scriptFilepath) {
doctoredFilepath = dir + "lib/" + scriptFilepath
Expand Down
2 changes: 1 addition & 1 deletion user/hub.dat
Original file line number Diff line number Diff line change
@@ -1 +1 @@
hub, /Users/tim/Charm/rsc/hub/hub.hub
hub/hub.hub

0 comments on commit 8cd4a84

Please sign in to comment.