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 {
|
} else {
|
||||||
pathsToTest = []string{
|
pathsToTest = []string{
|
||||||
filepath.Join(origin, realpath, "init.ar"),
|
|
||||||
filepath.Join(origin, path),
|
filepath.Join(origin, path),
|
||||||
|
filepath.Join(origin, realpath, "init.ar"),
|
||||||
filepath.Join(origin, modules_folder, path),
|
filepath.Join(origin, modules_folder, path),
|
||||||
filepath.Join(origin, modules_folder, realpath, "init.ar"),
|
filepath.Join(origin, modules_folder, realpath, "init.ar"),
|
||||||
filepath.Join(ex, path),
|
filepath.Join(ex, path),
|
||||||
filepath.Join(ex, modules_folder, realpath, "init.ar"),
|
|
||||||
filepath.Join(ex, modules_folder, path),
|
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, path),
|
||||||
|
filepath.Join(executable, modules_folder, realpath, "init.ar"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var p string
|
var p string
|
||||||
var found bool
|
var found bool
|
||||||
for _, p = range pathsToTest {
|
for _, p = range pathsToTest {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"os"
|
"path/filepath"
|
||||||
"strings"
|
"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}
|
return nil, ArErr{"Type Error", "import requires a string, got type '" + typeof(val) + "'", importOBJ.line, importOBJ.path, importOBJ.code, true}
|
||||||
}
|
}
|
||||||
path := val.(string)
|
path := val.(string)
|
||||||
ex, e := os.Getwd()
|
parent := filepath.Dir(importOBJ.path)
|
||||||
if e != nil {
|
stackMap, err := importMod(path, parent, false, stack[0])
|
||||||
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])
|
|
||||||
if err.EXISTS {
|
if err.EXISTS {
|
||||||
if err.line == 0 {
|
if err.line == 0 {
|
||||||
err.line = importOBJ.line
|
err.line = importOBJ.line
|
||||||
|
|||||||
@@ -127,5 +127,11 @@ func ArSocket(args ...any) (any, ArErr) {
|
|||||||
return nil, ArErr{}
|
return nil, ArErr{}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"isClosed": builtinFunc{
|
||||||
|
"isClosed",
|
||||||
|
func(args ...any) (any, ArErr) {
|
||||||
|
return ln == nil, ArErr{}
|
||||||
|
},
|
||||||
|
},
|
||||||
}), ArErr{}
|
}), ArErr{}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user