mirror of
https://github.com/Open-Argon/argon-v3.git
synced 2025-12-06 08:56:07 +00:00
add isClosed to socket
This commit is contained in:
@@ -73,18 +73,17 @@ func importMod(realpath string, origin string, main bool, global ArObject) (ArOb
|
||||
}
|
||||
} else {
|
||||
pathsToTest = []string{
|
||||
filepath.Join(origin, realpath, "init.ar"),
|
||||
filepath.Join(origin, path),
|
||||
filepath.Join(origin, realpath, "init.ar"),
|
||||
filepath.Join(origin, modules_folder, path),
|
||||
filepath.Join(origin, modules_folder, realpath, "init.ar"),
|
||||
filepath.Join(ex, path),
|
||||
filepath.Join(ex, modules_folder, realpath, "init.ar"),
|
||||
filepath.Join(ex, modules_folder, path),
|
||||
filepath.Join(executable, modules_folder, realpath, "init.ar"),
|
||||
filepath.Join(ex, modules_folder, realpath, "init.ar"),
|
||||
filepath.Join(executable, modules_folder, path),
|
||||
filepath.Join(executable, modules_folder, realpath, "init.ar"),
|
||||
}
|
||||
}
|
||||
|
||||
var p string
|
||||
var found bool
|
||||
for _, p = range pathsToTest {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
)
|
||||
|
||||
@@ -84,11 +84,8 @@ func runImport(importOBJ ArImport, stack stack, stacklevel int) (any, ArErr) {
|
||||
return nil, ArErr{"Type Error", "import requires a string, got type '" + typeof(val) + "'", importOBJ.line, importOBJ.path, importOBJ.code, true}
|
||||
}
|
||||
path := val.(string)
|
||||
ex, e := os.Getwd()
|
||||
if e != nil {
|
||||
return nil, ArErr{"File Error", "could not get current working directory", importOBJ.line, importOBJ.path, importOBJ.code, true}
|
||||
}
|
||||
stackMap, err := importMod(path, ex, false, stack[0])
|
||||
parent := filepath.Dir(importOBJ.path)
|
||||
stackMap, err := importMod(path, parent, false, stack[0])
|
||||
if err.EXISTS {
|
||||
if err.line == 0 {
|
||||
err.line = importOBJ.line
|
||||
|
||||
@@ -127,5 +127,11 @@ func ArSocket(args ...any) (any, ArErr) {
|
||||
return nil, ArErr{}
|
||||
},
|
||||
},
|
||||
"isClosed": builtinFunc{
|
||||
"isClosed",
|
||||
func(args ...any) (any, ArErr) {
|
||||
return ln == nil, ArErr{}
|
||||
},
|
||||
},
|
||||
}), ArErr{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user