mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
@@ -95,7 +95,7 @@ pub fn chdir(path string) {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mkdir(path string) ? {
|
||||
pub fn mkdir(path string) ! {
|
||||
verbose_trace_strong(modfn(@MOD, @FN), 'mkdir ${path}')
|
||||
os.mkdir(path) or {
|
||||
verbose_trace(modfn(@MOD, @FN), '## failed.')
|
||||
@@ -103,7 +103,7 @@ pub fn mkdir(path string) ? {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn mkdir_all(path string) ? {
|
||||
pub fn mkdir_all(path string) ! {
|
||||
verbose_trace_strong(modfn(@MOD, @FN), 'mkdir -p ${path}')
|
||||
os.mkdir_all(path) or {
|
||||
verbose_trace(modfn(@MOD, @FN), '## failed.')
|
||||
@@ -123,7 +123,7 @@ pub fn rmrf(path string) {
|
||||
}
|
||||
|
||||
// execute a command, and return a result, or an error, if it failed in any way.
|
||||
pub fn exec(cmd string) ?os.Result {
|
||||
pub fn exec(cmd string) !os.Result {
|
||||
verbose_trace_strong(modfn(@MOD, @FN), cmd)
|
||||
x := os.execute(cmd)
|
||||
if x.exit_code != 0 {
|
||||
|
||||
@@ -721,7 +721,7 @@ pub fn get_test_details(file string) TestDetails {
|
||||
return res
|
||||
}
|
||||
|
||||
pub fn find_started_process(pname string) ?string {
|
||||
pub fn find_started_process(pname string) !string {
|
||||
for line in testing.all_processes {
|
||||
if line.contains(pname) {
|
||||
return line
|
||||
|
||||
@@ -169,7 +169,7 @@ Try ${tool_name} -h for more help...')
|
||||
}
|
||||
}
|
||||
|
||||
fn validate_options(options Options) ? {
|
||||
fn validate_options(options Options) ! {
|
||||
if options.patch && options.major {
|
||||
return error('Cannot specify both --patch and --major.')
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ fn (mut foptions FormatOptions) find_diff_cmd() string {
|
||||
return foptions.diff_cmd
|
||||
}
|
||||
|
||||
fn (mut foptions FormatOptions) post_process_file(file string, formatted_file_path string) ? {
|
||||
fn (mut foptions FormatOptions) post_process_file(file string, formatted_file_path string) ! {
|
||||
if formatted_file_path.len == 0 {
|
||||
return
|
||||
}
|
||||
@@ -307,7 +307,7 @@ fn file_to_mod_name_and_is_module_file(file string) (string, bool) {
|
||||
return mod_name, is_module_file
|
||||
}
|
||||
|
||||
fn read_source_lines(file string) ?[]string {
|
||||
fn read_source_lines(file string) ![]string {
|
||||
source_lines := os.read_lines(file) or { return error('can not read ${file}') }
|
||||
return source_lines
|
||||
}
|
||||
|
||||
@@ -414,7 +414,7 @@ fn vpm_update(m []string) {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_outdated() ?[]string {
|
||||
fn get_outdated() ![]string {
|
||||
module_names := get_installed_modules()
|
||||
mut outdated := []string{}
|
||||
for name in module_names {
|
||||
@@ -720,7 +720,7 @@ fn verbose_println(s string) {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_mod_by_url(name string) ?Mod {
|
||||
fn get_mod_by_url(name string) !Mod {
|
||||
if purl := urllib.parse(name) {
|
||||
verbose_println('purl: ${purl}')
|
||||
mod := Mod{
|
||||
@@ -733,7 +733,7 @@ fn get_mod_by_url(name string) ?Mod {
|
||||
return error('invalid url: ${name}')
|
||||
}
|
||||
|
||||
fn get_module_meta_info(name string) ?Mod {
|
||||
fn get_module_meta_info(name string) !Mod {
|
||||
if mod := get_mod_by_url(name) {
|
||||
return mod
|
||||
}
|
||||
|
||||
@@ -576,7 +576,7 @@ fn cleanup_files(file string) {
|
||||
}
|
||||
}
|
||||
|
||||
fn repl_run_vfile(file string) ?os.Result {
|
||||
fn repl_run_vfile(file string) !os.Result {
|
||||
$if trace_repl_temp_files ? {
|
||||
eprintln('>> repl_run_vfile file: ${file}')
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ fn warn_and_exit(err string) {
|
||||
}
|
||||
|
||||
// get the system environment registry handle
|
||||
fn get_reg_sys_env_handle() ?voidptr {
|
||||
fn get_reg_sys_env_handle() !voidptr {
|
||||
$if windows { // wrap for cross-compile compat
|
||||
// open the registry key
|
||||
reg_key_path := 'Environment'
|
||||
@@ -166,7 +166,7 @@ fn get_reg_sys_env_handle() ?voidptr {
|
||||
}
|
||||
|
||||
// get a value from a given $key
|
||||
fn get_reg_value(reg_env_key voidptr, key string) ?string {
|
||||
fn get_reg_value(reg_env_key voidptr, key string) !string {
|
||||
$if windows {
|
||||
// query the value (shortcut the sizing step)
|
||||
reg_value_size := u32(4095) // this is the max length (not for the registry, but for the system %PATH%)
|
||||
@@ -180,7 +180,7 @@ fn get_reg_value(reg_env_key voidptr, key string) ?string {
|
||||
}
|
||||
|
||||
// sets the value for the given $key to the given $value
|
||||
fn set_reg_value(reg_key voidptr, key string, value string) ?bool {
|
||||
fn set_reg_value(reg_key voidptr, key string, value string) !bool {
|
||||
$if windows {
|
||||
if C.RegSetValueExW(reg_key, key.to_wide(), 0, C.REG_EXPAND_SZ, value.to_wide(),
|
||||
value.len * 2) != 0 {
|
||||
@@ -193,7 +193,7 @@ fn set_reg_value(reg_key voidptr, key string, value string) ?bool {
|
||||
|
||||
// Broadcasts a message to all listening windows (explorer.exe in particular)
|
||||
// letting them know that the system environment has changed and should be reloaded
|
||||
fn send_setting_change_msg(message_data string) ?bool {
|
||||
fn send_setting_change_msg(message_data string) !bool {
|
||||
$if windows {
|
||||
if C.SendMessageTimeoutW(os.hwnd_broadcast, os.wm_settingchange, 0, unsafe { &u32(message_data.to_wide()) },
|
||||
os.smto_abortifhung, 5000, 0) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user