mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: merge with filepath
This commit is contained in:
@@ -6,7 +6,6 @@ module compiler
|
||||
import (
|
||||
os
|
||||
time
|
||||
filepath
|
||||
v.pref
|
||||
term
|
||||
)
|
||||
@@ -32,7 +31,7 @@ fn (v mut V) cc() {
|
||||
}
|
||||
v.build_thirdparty_obj_files()
|
||||
vexe := pref.vexe_path()
|
||||
vdir := filepath.dir(vexe)
|
||||
vdir := os.dir(vexe)
|
||||
// Just create a C/JavaScript file and exit
|
||||
// for example: `v -o v.c compiler`
|
||||
ends_with_c := v.pref.out_name.ends_with('.c')
|
||||
@@ -153,8 +152,8 @@ fn (v mut V) cc() {
|
||||
}
|
||||
if v.pref.build_mode == .build_module {
|
||||
// Create the modules & out directory if it's not there.
|
||||
mut out_dir := if v.pref.path.starts_with('vlib') { '$v_modules_path${filepath.separator}cache${filepath.separator}$v.pref.path' } else { '$v_modules_path${filepath.separator}$v.pref.path' }
|
||||
pdir := out_dir.all_before_last(filepath.separator)
|
||||
mut out_dir := if v.pref.path.starts_with('vlib') { '$v_modules_path${os.path_separator}cache${os.path_separator}$v.pref.path' } else { '$v_modules_path${os.path_separator}$v.pref.path' }
|
||||
pdir := out_dir.all_before_last(os.path_separator)
|
||||
if !os.is_dir(pdir) {
|
||||
os.mkdir_all(pdir)
|
||||
}
|
||||
@@ -220,14 +219,14 @@ fn (v mut V) cc() {
|
||||
a << '-c'
|
||||
}
|
||||
else if v.pref.is_cache {
|
||||
builtin_o_path := filepath.join(v_modules_path,'cache','vlib','builtin.o')
|
||||
builtin_o_path := os.join(v_modules_path,'cache','vlib','builtin.o')
|
||||
a << builtin_o_path.replace('builtin.o', 'strconv.o') // TODO hack no idea why this is needed
|
||||
if os.exists(builtin_o_path) {
|
||||
libs = builtin_o_path
|
||||
}
|
||||
else {
|
||||
println('$builtin_o_path not found... building module builtin')
|
||||
os.system('$vexe build module vlib${filepath.separator}builtin')
|
||||
os.system('$vexe build module vlib${os.path_separator}builtin')
|
||||
}
|
||||
for imp in v.table.imports {
|
||||
if imp.contains('vweb') {
|
||||
@@ -236,8 +235,8 @@ fn (v mut V) cc() {
|
||||
if imp == 'webview' {
|
||||
continue
|
||||
}
|
||||
imp_path := imp.replace('.', filepath.separator)
|
||||
path := '$v_modules_path${filepath.separator}cache${filepath.separator}vlib${filepath.separator}${imp_path}.o'
|
||||
imp_path := imp.replace('.', os.path_separator)
|
||||
path := '$v_modules_path${os.path_separator}cache${os.path_separator}vlib${os.path_separator}${imp_path}.o'
|
||||
// println('adding ${imp_path}.o')
|
||||
if os.exists(path) {
|
||||
libs += ' ' + path
|
||||
@@ -254,7 +253,7 @@ fn (v mut V) cc() {
|
||||
}
|
||||
}
|
||||
else {
|
||||
os.system('$vexe build module vlib${filepath.separator}$imp_path')
|
||||
os.system('$vexe build module vlib${os.path_separator}$imp_path')
|
||||
}
|
||||
}
|
||||
if path.ends_with('vlib/ui.o') {
|
||||
|
||||
Reference in New Issue
Block a user