mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
js,os: fix return
in or
blocks; Properly get path_delimiter and path_separator in JS (#13179)
This commit is contained in:
@ -1,17 +1,33 @@
|
||||
module os
|
||||
|
||||
$if js_node {
|
||||
#const $fs = require('fs');
|
||||
#const $path = require('path');
|
||||
#const tty = require('tty')
|
||||
#var $fs = require('fs');
|
||||
#var $path = require('path');
|
||||
#var tty = require('tty')
|
||||
}
|
||||
|
||||
pub const (
|
||||
path_delimiter = '/'
|
||||
path_separator = '/'
|
||||
path_delimiter = get_path_delimiter()
|
||||
path_separator = get_path_separator()
|
||||
args = []string{}
|
||||
)
|
||||
|
||||
fn get_path_delimiter() string {
|
||||
delimiter := ':'
|
||||
$if js_node {
|
||||
#delimiter.str = $path.delimiter
|
||||
}
|
||||
return delimiter
|
||||
}
|
||||
|
||||
fn get_path_separator() string {
|
||||
separator := '/'
|
||||
$if js_node {
|
||||
#separator.str = $path.sep
|
||||
}
|
||||
return separator
|
||||
}
|
||||
|
||||
fn init() {
|
||||
$if js_node {
|
||||
#$process.argv.forEach(function(val,index) { os__args.arr[index] = new string(val); })
|
||||
|
Reference in New Issue
Block a user