fix "v symlink" with relative paths
parent
8e32ef382a
commit
dcea76ff41
|
@ -1036,21 +1036,22 @@ pub fn vfmt(args[]string) {
|
||||||
|
|
||||||
pub fn create_symlink() {
|
pub fn create_symlink() {
|
||||||
$if windows { return }
|
$if windows { return }
|
||||||
vexe := os.executable()
|
vexe := vexe_path()
|
||||||
link_path := '/usr/local/bin/v'
|
link_path := '/usr/local/bin/v'
|
||||||
ret := os.system('ln -sf $vexe $link_path')
|
ret := os.system('ln -sf $vexe $link_path')
|
||||||
if ret == 0 {
|
if ret == 0 {
|
||||||
println('symlink "$link_path" has been created')
|
println('Symlink "$link_path" has been created')
|
||||||
} else {
|
} else {
|
||||||
println('failed to create symlink "$link_path", '+
|
println('Failed to create symlink "$link_path". Try again with sudo.')
|
||||||
'make sure you run with sudo')
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn vexe_path() string {
|
pub fn vexe_path() string {
|
||||||
vexe := os.getenv('VEXE')
|
vexe := os.getenv('VEXE')
|
||||||
if '' != vexe { return vexe }
|
if '' != vexe { return vexe }
|
||||||
return os.executable()
|
real_vexe_path := os.realpath(os.executable())
|
||||||
|
os.setenv('VEXE', real_vexe_path, true)
|
||||||
|
return real_vexe_path
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn verror(s string) {
|
pub fn verror(s string) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ mut:
|
||||||
// `mod` == "vlib/os"
|
// `mod` == "vlib/os"
|
||||||
fn generate_vh(mod string) {
|
fn generate_vh(mod string) {
|
||||||
println('\n\n\n\nGenerating a V header file for module `$mod`')
|
println('\n\n\n\nGenerating a V header file for module `$mod`')
|
||||||
vexe := os.executable()
|
vexe := vexe_path()
|
||||||
full_mod_path := filepath.join(os.dir(vexe), mod)
|
full_mod_path := filepath.join(os.dir(vexe), mod)
|
||||||
dir := if mod.starts_with('vlib') { '$compiler.v_modules_path${os.path_separator}$mod' } else { mod }
|
dir := if mod.starts_with('vlib') { '$compiler.v_modules_path${os.path_separator}$mod' } else { mod }
|
||||||
path := dir + '.vh'
|
path := dir + '.vh'
|
||||||
|
|
Loading…
Reference in New Issue