Skip to content

Commit b801083

Browse files
committed
Revert "os: deprecate os.getwd in favor of os.get_current_dir (part 1) (#22966)"
This reverts commit 9300982.
1 parent 9300982 commit b801083

34 files changed

+46
-60
lines changed

cmd/tools/amalgamate.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ fn (mut c Context) amalgamate() ! {
109109
if c.config.input_files.len == 0 {
110110
// source += '/* ########## stdin */\n'
111111
// if there are no input files, read from stdin
112-
local_dir := os.get_current_dir()
112+
local_dir := os.getwd()
113113
source += c.handle_includes(local_dir, os.get_raw_lines_joined())!
114114
// source += '/* ########## stdin end */\n'
115115
} else {

cmd/tools/bench/map_clear_runner.vsh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ step := os.args[3] or { '500_000' }.int()
1414
os.chdir(os.dir(@VEXE))!
1515
vcmd := 'v ${flags} cmd/tools/bench/map_clear.v'
1616

17-
println('>> start: ${start} | end: ${end} | step: ${step} | workdir: "${os.get_current_dir()}" | flags: "${flags}" | vcmd: "${vcmd}"')
17+
println('>> start: ${start} | end: ${end} | step: ${step} | workdir: "${os.getwd()}" | flags: "${flags}" | vcmd: "${vcmd}"')
1818
assert os.system(vcmd) == 0
1919

2020
println('running...')

cmd/tools/fast/fast_job.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ fn main() {
5353
elog('fast_job PATH: ${os.getenv('PATH')}')
5454

5555
os.chdir(fast_dir)!
56-
elog('fast_job start in os.get_current_dir(): ${os.get_current_dir()}')
56+
elog('fast_job start in os.getwd(): ${os.getwd()}')
5757

5858
defer {
5959
elog('fast_job end')

cmd/tools/modules/testing/common.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ pub fn (mut ts TestSession) add(file string) {
370370
pub fn (mut ts TestSession) test() {
371371
// Ensure that .tmp.c files generated from compiling _test.v files,
372372
// are easy to delete at the end, *without* affecting the existing ones.
373-
current_wd := os.get_current_dir()
373+
current_wd := os.getwd()
374374
if current_wd == os.wd_at_startup && current_wd == ts.vroot {
375375
ts.root_relative = true
376376
}

cmd/tools/performance_compare.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ mut:
2525

2626
fn new_context() Context {
2727
return Context{
28-
cwd: os.get_current_dir()
28+
cwd: os.getwd()
2929
commit_after: 'master'
3030
warmups: 4
3131
}

cmd/tools/test_os_process.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ fn main() {
7878
eprintln('> args: ${args} | context: ${ctx}')
7979
}
8080
if ctx.show_wd {
81-
ctx.println('WORK_DIR=${os.get_current_dir()}')
81+
ctx.println('WORK_DIR=${os.getwd()}')
8282
}
8383
if ctx.show_env {
8484
all := os.environ()

cmd/tools/vast/vast.v

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ fn get_abs_path(path string) string {
8787
if os.is_abs_path(path) {
8888
return path
8989
} else if path.starts_with('./') {
90-
return os.join_path(os.get_current_dir(), path[2..])
90+
return os.join_path(os.getwd(), path[2..])
9191
} else {
92-
return os.join_path(os.get_current_dir(), path)
92+
return os.join_path(os.getwd(), path)
9393
}
9494
}
9595

cmd/tools/vbug.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn get_vdoctor_output(is_verbose bool) string {
2020
fn get_v_build_output(is_verbose bool, is_yes bool, file_path string) string {
2121
mut vexe := os.getenv('VEXE')
2222
// prepare a V compiler with -g to have better backtraces if possible
23-
wd := os.get_current_dir()
23+
wd := os.getwd()
2424
os.chdir(vroot) or {}
2525
verbose_flag := if is_verbose { '-v' } else { '' }
2626
vdbg_path := $if windows { '${vroot}/vdbg.exe' } $else { '${vroot}/vdbg' }

cmd/tools/vcover/main.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ fn normalize_path(path string) string {
149149

150150
fn main() {
151151
mut ctx := Context{}
152-
ctx.working_folder = normalize_path(os.real_path(os.get_current_dir()))
152+
ctx.working_folder = normalize_path(os.real_path(os.getwd()))
153153
mut fp := flag.new_flag_parser(os.args#[1..])
154154
fp.application('v cover')
155155
fp.version('0.0.2')

cmd/tools/vcreate/vcreate.v

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ fn init_project(cmd Command) ! {
131131
mut c := Create{
132132
template: get_template(cmd)
133133
}
134-
dir_name := check_name(os.file_name(os.get_current_dir()))
134+
dir_name := check_name(os.file_name(os.getwd()))
135135
if !os.exists('v.mod') {
136136
mod_dir_has_hyphens := dir_name.contains('-')
137137
c.name = if mod_dir_has_hyphens { dir_name.replace('-', '_') } else { dir_name }

0 commit comments

Comments
 (0)