mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
os: ext => file_ext
This commit is contained in:
parent
a6347118cd
commit
9c5de77f12
@ -617,7 +617,7 @@ fn print_c_errno() {
|
||||
println('errno=$e err=$se')
|
||||
}
|
||||
|
||||
pub fn ext(path string) string {
|
||||
pub fn file_ext(path string) string {
|
||||
pos := path.last_index('.') or {
|
||||
return ''
|
||||
}
|
||||
|
@ -296,8 +296,8 @@ fn test_is_executable_writable_readable() {
|
||||
}
|
||||
|
||||
fn test_ext() {
|
||||
assert os.ext('file.v') == '.v'
|
||||
assert os.ext('file') == ''
|
||||
assert os.file_ext('file.v') == '.v'
|
||||
assert os.file_ext('file') == ''
|
||||
}
|
||||
|
||||
fn test_is_abs() {
|
||||
|
@ -330,7 +330,7 @@ fn (ctx mut Context) scan_static_directory(directory_path, mount_path string) {
|
||||
if os.is_dir(file) {
|
||||
ctx.scan_static_directory(directory_path + '/' + file, mount_path + '/' + file)
|
||||
} 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.
|
||||
// Use serve_static directly to add non-standard mime types.
|
||||
|
Loading…
Reference in New Issue
Block a user