mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os, filepath: reorganize functions
This commit is contained in:
committed by
Alexander Medvednikov
parent
6e130cd446
commit
dced76d1a4
@@ -2,13 +2,16 @@
|
||||
// Use of this source code is governed by an MIT license
|
||||
// that can be found in the LICENSE file.
|
||||
|
||||
import os
|
||||
import time
|
||||
import (
|
||||
os
|
||||
time
|
||||
filepath
|
||||
)
|
||||
|
||||
fn main() {
|
||||
exe := os.executable()
|
||||
dir := os.dir(exe)
|
||||
vdir := os.dir(os.dir(dir))
|
||||
dir := filepath.dir(exe)
|
||||
vdir := filepath.dir(filepath.dir(dir))
|
||||
if !os.exists('$vdir/v') && !os.is_dir('$vdir/vlib') {
|
||||
println('fast.html generator needs to be located in `v/tools/fast/`')
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ pub fn v_build_failing(zargs string, folder string) bool {
|
||||
main_label := 'Building $folder ...'
|
||||
finish_label := 'building $folder'
|
||||
vexe := vexe_path()
|
||||
parent_dir := os.dir(vexe)
|
||||
parent_dir := filepath.dir(vexe)
|
||||
vlib_should_be_present( parent_dir )
|
||||
vargs := zargs.replace(vexe, '')
|
||||
|
||||
@@ -148,7 +148,7 @@ pub fn building_any_v_binaries_failed() bool {
|
||||
eprintln('Building V binaries...')
|
||||
eprintln('VFLAGS is: "' + os.getenv('VFLAGS') + '"')
|
||||
vexe := testing.vexe_path()
|
||||
parent_dir := os.dir(vexe)
|
||||
parent_dir := filepath.dir(vexe)
|
||||
testing.vlib_should_be_present( parent_dir )
|
||||
os.chdir( parent_dir )
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import os
|
||||
|
||||
import flag
|
||||
import (
|
||||
os
|
||||
flag
|
||||
filepath
|
||||
)
|
||||
|
||||
const (
|
||||
tool_version = '0.0.4'
|
||||
@@ -212,7 +214,7 @@ fn main(){
|
||||
used_tools_must_exist(['cp','rm','strip','make','git','upx','cc','wc','tail','hyperfine'])
|
||||
mut context := new_context()
|
||||
mut fp := flag.new_flag_parser(os.args)
|
||||
fp.application(os.filename(os.executable()))
|
||||
fp.application(filepath.filename(os.executable()))
|
||||
fp.version( tool_version )
|
||||
fp.description( tool_description )
|
||||
fp.arguments_description('COMMIT_BEFORE [COMMIT_AFTER]')
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
module main
|
||||
|
||||
import os
|
||||
import flag
|
||||
import compiler
|
||||
import strings
|
||||
import (
|
||||
os
|
||||
flag
|
||||
strings
|
||||
filepath
|
||||
compiler
|
||||
)
|
||||
|
||||
const (
|
||||
tool_version = '0.0.1'
|
||||
@@ -48,10 +51,10 @@ fn analyze_v_file(file string) {
|
||||
|
||||
fn main(){
|
||||
toolexe := os.executable()
|
||||
compiler.set_vroot_folder( os.dir(os.dir(toolexe)) )
|
||||
|
||||
compiler.set_vroot_folder( filepath.dir(filepath.dir(toolexe)) )
|
||||
|
||||
mut fp := flag.new_flag_parser(os.args)
|
||||
fp.application(os.filename(toolexe))
|
||||
fp.application(filepath.filename(toolexe))
|
||||
fp.version( tool_version )
|
||||
fp.description( tool_description )
|
||||
fp.arguments_description('FILE.v/FOLDER [FILE.v/FOLDER]...')
|
||||
|
||||
@@ -25,7 +25,7 @@ fn v_test_compiler(vargs string){
|
||||
fn v_test_compiler2(vargs string){
|
||||
|
||||
vexe := testing.vexe_path()
|
||||
parent_dir := os.dir(vexe)
|
||||
parent_dir := filepath.dir(vexe)
|
||||
testing.vlib_should_be_present( parent_dir )
|
||||
|
||||
// Changing the current directory is needed for some of the compiler tests,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import os
|
||||
import (
|
||||
os
|
||||
filepath
|
||||
)
|
||||
|
||||
fn main() {
|
||||
println('Updating V...')
|
||||
|
||||
Reference in New Issue
Block a user