mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: fix live reload on win with auto completed filename .\file.v
This commit is contained in:
parent
9b7ca248f0
commit
b1e1536d56
@ -4,7 +4,10 @@
|
|||||||
|
|
||||||
module main
|
module main
|
||||||
|
|
||||||
import strings
|
import(
|
||||||
|
os
|
||||||
|
strings
|
||||||
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
MaxLocalVars = 50
|
MaxLocalVars = 50
|
||||||
@ -455,7 +458,7 @@ fn (p mut Parser) fn_decl() {
|
|||||||
}
|
}
|
||||||
// We are in live code reload mode, call the .so loader in bg
|
// We are in live code reload mode, call the .so loader in bg
|
||||||
if p.pref.is_live {
|
if p.pref.is_live {
|
||||||
file_base := p.file_path.replace('.v', '')
|
file_base := os.filename(p.file_path).replace('.v', '')
|
||||||
if p.os != .windows && p.os != .msvc {
|
if p.os != .windows && p.os != .msvc {
|
||||||
so_name := file_base + '.so'
|
so_name := file_base + '.so'
|
||||||
p.genln('
|
p.genln('
|
||||||
|
@ -35,13 +35,13 @@ fn (v &V) generate_hotcode_reloading_declarations() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn (v mut V) generate_hot_reload_code() {
|
fn (v &V) generate_hot_reload_code() {
|
||||||
mut cgen := v.cgen
|
mut cgen := v.cgen
|
||||||
|
|
||||||
// Hot code reloading
|
// Hot code reloading
|
||||||
if v.pref.is_live {
|
if v.pref.is_live {
|
||||||
file := v.dir
|
mut file := os.realpath(v.dir)
|
||||||
file_base := v.dir.replace('.v', '')
|
file_base := os.filename(file).replace('.v', '')
|
||||||
so_name := file_base + '.so'
|
so_name := file_base + '.so'
|
||||||
// Need to build .so file before building the live application
|
// Need to build .so file before building the live application
|
||||||
// The live app needs to load this .so file on initialization.
|
// The live app needs to load this .so file on initialization.
|
||||||
@ -49,6 +49,7 @@ fn (v mut V) generate_hot_reload_code() {
|
|||||||
|
|
||||||
if os.user_os() == 'windows' {
|
if os.user_os() == 'windows' {
|
||||||
vexe = vexe.replace('\\', '\\\\')
|
vexe = vexe.replace('\\', '\\\\')
|
||||||
|
file = file.replace('\\', '\\\\')
|
||||||
}
|
}
|
||||||
|
|
||||||
mut msvc := ''
|
mut msvc := ''
|
||||||
|
Loading…
Reference in New Issue
Block a user