1
0
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:
playX
2022-01-15 10:55:03 +03:00
committed by GitHub
parent 9fd65b5b18
commit 7fe62a8b3e
3 changed files with 84 additions and 10 deletions

View File

@ -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); })