1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

don't use /var/tmp

This commit is contained in:
Alexander Medvednikov 2019-06-22 22:00:38 +02:00
parent ce3d560e09
commit 96e15b0f0f
2 changed files with 11 additions and 13 deletions

View File

@ -21,10 +21,7 @@ enum BuildMode {
} }
fn vtmp_path() string { fn vtmp_path() string {
$if windows {
return os.home_dir() + '/.vlang$Version/' return os.home_dir() + '/.vlang$Version/'
}
return '/var/tmp/vlang$Version/'
} }
const ( const (
@ -98,16 +95,19 @@ fn main() {
if '-h' in args || '--help' in args || 'help' in args { if '-h' in args || '--help' in args || 'help' in args {
println(HelpText) println(HelpText)
} }
// TODO quit if the compiler is too old
// u := os.file_last_mod_unix('/var/tmp/alex') // u := os.file_last_mod_unix('/var/tmp/alex')
// t := time.unixn(u) // Create a temp directory if it's not there.
// println(t.clean()) if !os.file_exists(TmpPath) {
// If there's not tmp path with current version yet, the user must be using a pre-built package
// Copy the `vlib` directory to the tmp path.
if !os.file_exists(TmpPath) && os.file_exists('vlib') {
os.mkdir(TmpPath) os.mkdir(TmpPath)
os.system2('cp -rf vlib $TmpPath/')
// os.system2('cp -rf json $TmpPath/')
} }
// If there's no tmp path with current version yet, the user must be using a pre-built package
// Copy the `vlib` directory to the tmp path.
/*
// TODO
if !os.file_exists(TmpPath) && os.file_exists('vlib') {
}
*/
// Just fmt and exit // Just fmt and exit
if args.contains('fmt') { if args.contains('fmt') {
file := args.last() file := args.last()

View File

@ -369,9 +369,7 @@ pub fn mkdir(path string) {
C.CreateDirectory(path.cstr(), 0) C.CreateDirectory(path.cstr(), 0)
} }
$else { $else {
println('AAAAAAAA $$ "$path"')
C.mkdir(path.cstr(), 511)// S_IRWXU | S_IRWXG | S_IRWXO C.mkdir(path.cstr(), 511)// S_IRWXU | S_IRWXG | S_IRWXO
// os.system2('mkdir -p $path')
} }
} }