os: ext => file_ext

pull/4123/head
yuyi 2020-03-26 21:18:08 +08:00 committed by GitHub
parent a6347118cd
commit 9c5de77f12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 4 deletions

View File

@ -617,7 +617,7 @@ fn print_c_errno() {
println('errno=$e err=$se') println('errno=$e err=$se')
} }
pub fn ext(path string) string { pub fn file_ext(path string) string {
pos := path.last_index('.') or { pos := path.last_index('.') or {
return '' return ''
} }

View File

@ -296,8 +296,8 @@ fn test_is_executable_writable_readable() {
} }
fn test_ext() { fn test_ext() {
assert os.ext('file.v') == '.v' assert os.file_ext('file.v') == '.v'
assert os.ext('file') == '' assert os.file_ext('file') == ''
} }
fn test_is_abs() { fn test_is_abs() {

View File

@ -330,7 +330,7 @@ fn (ctx mut Context) scan_static_directory(directory_path, mount_path string) {
if os.is_dir(file) { if os.is_dir(file) {
ctx.scan_static_directory(directory_path + '/' + file, mount_path + '/' + file) ctx.scan_static_directory(directory_path + '/' + file, mount_path + '/' + file)
} else if file.contains('.') && ! file.starts_with('.') && ! file.ends_with('.') { } else if file.contains('.') && ! file.starts_with('.') && ! file.ends_with('.') {
ext := os.ext(file) ext := os.file_ext(file)
// Rudimentary guard against adding files not in mime_types. // Rudimentary guard against adding files not in mime_types.
// Use serve_static directly to add non-standard mime types. // Use serve_static directly to add non-standard mime types.