mirror of
https://github.com/Kugelschieber/asl.git
synced 2026-01-18 12:00:25 +00:00
Also converting paths to Windows paths now.
This commit is contained in:
@@ -69,13 +69,13 @@ func readAslFiles(path string) {
|
|||||||
name := dir[i].Name()
|
name := dir[i].Name()
|
||||||
|
|
||||||
if dir[i].IsDir() && recursive {
|
if dir[i].IsDir() && recursive {
|
||||||
readAslFiles(path+"/"+name)
|
readAslFiles(filepath.FromSlash(path+"/"+name))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if !dir[i].IsDir() && strings.ToLower(filepath.Ext(name)) == extension {
|
if !dir[i].IsDir() && strings.ToLower(filepath.Ext(name)) == extension {
|
||||||
in := path+"/"+dir[i].Name()
|
in := filepath.FromSlash(path+"/"+dir[i].Name())
|
||||||
out := "./"+path[len(inDir):len(path)]
|
out := filepath.FromSlash("./"+path[len(inDir):len(path)])
|
||||||
newname := name[:len(name)-len(filepath.Ext(name))]
|
newname := name[:len(name)-len(filepath.Ext(name))]
|
||||||
|
|
||||||
file := ASLFile{in, out, newname}
|
file := ASLFile{in, out, newname}
|
||||||
@@ -86,7 +86,7 @@ func readAslFiles(path string) {
|
|||||||
|
|
||||||
func compile(path string) {
|
func compile(path string) {
|
||||||
for i := 0; i < len(aslFiles); i++ {
|
for i := 0; i < len(aslFiles); i++ {
|
||||||
out := path+"/"+aslFiles[i].out+"/"+aslFiles[i].newname+sqfextension
|
out := filepath.FromSlash(path+"/"+aslFiles[i].out+"/"+aslFiles[i].newname+sqfextension)
|
||||||
fmt.Println(aslFiles[i].in+" -> "+out)
|
fmt.Println(aslFiles[i].in+" -> "+out)
|
||||||
code, err := ioutil.ReadFile(aslFiles[i].in)
|
code, err := ioutil.ReadFile(aslFiles[i].in)
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ func compile(path string) {
|
|||||||
token := asl.Tokenize(code)
|
token := asl.Tokenize(code)
|
||||||
sqf := asl.Parse(token, pretty)
|
sqf := asl.Parse(token, pretty)
|
||||||
|
|
||||||
os.MkdirAll(path+"/"+aslFiles[i].out, 0777)
|
os.MkdirAll(filepath.FromSlash(path+"/"+aslFiles[i].out), 0777)
|
||||||
err = ioutil.WriteFile(out, []byte(sqf), 0666)
|
err = ioutil.WriteFile(out, []byte(sqf), 0666)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user