os: use unified way to deprecate functions

pull/3800/head
Alexey 2020-02-21 01:00:02 +03:00 committed by GitHub
parent 88b402fcf8
commit 8677a5981c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 10 deletions

View File

@ -650,26 +650,22 @@ fn print_c_errno() {
[deprecated] [deprecated]
pub fn ext(path string) string { pub fn ext(path string) string {
println('Use filepath.ext') panic('Use `filepath.ext` instead of `os.ext`')
return filepath.ext(path)
} }
[deprecated] [deprecated]
pub fn dir(path string) string { pub fn dir(path string) string {
println('Use filepath.dir') panic('Use `filepath.dir` instead of `os.dir`')
return filepath.dir(path)
} }
[deprecated] [deprecated]
pub fn basedir(path string) string { pub fn basedir(path string) string {
println('Use filepath.basedir') panic('Use `filepath.basedir` instead of `os.basedir`')
return filepath.basedir(path)
} }
[deprecated] [deprecated]
pub fn filename(path string) string { pub fn filename(path string) string {
println('Use filepath.filename') panic('Use `filepath.filename` instead of `os.filename`')
return filepath.filename(path)
} }
// get_line returns a one-line string from stdin // get_line returns a one-line string from stdin
@ -895,9 +891,9 @@ pub fn executable() string {
[deprecated] [deprecated]
pub fn dir_exists(path string) bool { pub fn dir_exists(path string) bool {
panic('use os.is_dir()') panic('Use `os.is_dir` instead of `os.dir_exists`')
// return false
} }
// is_dir returns a boolean indicating whether the given path is a directory. // is_dir returns a boolean indicating whether the given path is a directory.
pub fn is_dir(path string) bool { pub fn is_dir(path string) bool {
$if windows { $if windows {