Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vdoctor: fix format, windows, tcc #23361

Merged
merged 11 commits into from
Jan 4, 2025
22 changes: 16 additions & 6 deletions cmd/tools/vdoctor.v
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,13 @@ fn (mut a App) collect_info() {
}
a.line('OS', '${os_kind}, ${os_details}')
a.line('Processor', arch_details.join(', '))
total_memory := f64(runtime.total_memory()) / (1024.0 * 1024.0 * 1024.0)
free_memory := f64(runtime.free_memory()) / (1024.0 * 1024.0 * 1024.0)
a.line('Memory', '${free_memory:.2}GB/${total_memory:.2}GB')
total_memory := f32(runtime.total_memory()) / (1024.0 * 1024.0 * 1024.0)
spytheman marked this conversation as resolved.
Show resolved Hide resolved
free_memory := f32(runtime.free_memory()) / (1024.0 * 1024.0 * 1024.0)
if total_memory != 0 && free_memory != 0 {
a.line('Memory', '${free_memory:.2}GB/${total_memory:.2}GB')
} else {
a.line('Memory', 'N/A')
}

a.line('', '')
mut vexe := os.getenv('VEXE')
Expand All @@ -132,15 +136,14 @@ fn (mut a App) collect_info() {
a.line('.git/config present', os.is_file('.git/config').str())
a.line('', '')
a.line('CC version', a.cmd(command: 'cc --version'))
kbkpbot marked this conversation as resolved.
Show resolved Hide resolved
a.line('GCC version', a.cmd(command: 'gcc --version'))
a.line('gcc version', a.cmd(command: 'gcc --version'))
a.line('clang version', a.cmd(command: 'clang --version'))
if os_kind == 'windows' {
// Check for MSVC on windows
a.line('MSVC version', a.cmd(command: 'cl'))
a.line('msvc version', a.cmd(command: 'cl'))
}
a.report_tcc_version('thirdparty/tcc')
a.line('glibc version', a.cmd(command: 'ldd --version'))
a.line('emcc version', a.cmd(command: 'emcc --version'))
}

struct CmdConfig {
Expand Down Expand Up @@ -296,6 +299,13 @@ fn diagnose_dir(path string) string {
if !is_writable_dir(path) {
diagnostics << 'NOT writable'
}
if path.contains(' ') {
diagnostics << 'contains spaces'
}
path_non_ascii_runes := path.runes().filter(it > 255)
if path_non_ascii_runes.len > 0 {
diagnostics << 'contains these non ASCII characters: ${path_non_ascii_runes}'
}
if diagnostics.len == 0 {
diagnostics << 'OK'
}
Expand Down
Loading