Skip to content

Commit

Permalink
os: clarify some doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ttytm committed Apr 7, 2024
1 parent ad17be5 commit b284c23
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions vlib/os/os.v
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ pub fn get_raw_lines_joined() string {
return res
}

// user_os returns current user operating system name.
// user_os returns the current user's operating system name.
pub fn user_os() string {
$if linux {
return 'linux'
Expand Down Expand Up @@ -443,7 +443,7 @@ pub fn user_os() string {
return 'unknown'
}

// user_names returns an array of the name of every user on the system.
// user_names returns an array containing the names of all users on the system.
pub fn user_names() ![]string {
$if windows {
result := execute('wmic useraccount get name')
Expand All @@ -465,7 +465,7 @@ pub fn user_names() ![]string {
}
}

// home_dir returns path to the user's home directory.
// home_dir returns the path to the current user's home directory.
pub fn home_dir() string {
$if windows {
return getenv('USERPROFILE')
Expand All @@ -490,8 +490,8 @@ pub fn expand_tilde_to_home(path string) string {
return path
}

// write_file writes `text` data to the file in `path`.
// If `path` exists, the contents of `path` will be overwritten with the contents of `text`.
// write_file writes `text` data to a file with the given `path`.
// If `path` already exists, it will be overwritten.
pub fn write_file(path string, text string) ! {
mut f := create(path)!
unsafe { f.write_full_buffer(text.str, usize(text.len))! }
Expand All @@ -510,15 +510,15 @@ fn error_failed_to_find_executable() IError {
return &ExecutableNotFoundError{}
}

// find_abs_path_of_executable walks the environment PATH, just like most shell do, it returns
// the absolute path of the executable if found
pub fn find_abs_path_of_executable(exepath string) !string {
if exepath == '' {
return error('expected non empty `exepath`')
// find_abs_path_of_executable searches the environment PATH for the
// absolute path of the given executable name.
pub fn find_abs_path_of_executable(executable string) !string {
if executable == '' {
return error('expected non empty `executable`')
}

for suffix in executable_suffixes {
fexepath := exepath + suffix
fexepath := executable + suffix
if is_abs_path(fexepath) {
return real_path(fexepath)
}
Expand Down

0 comments on commit b284c23

Please sign in to comment.