File tree Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Expand file tree Collapse file tree 3 files changed +4
-16
lines changed Original file line number Diff line number Diff line change @@ -16,20 +16,6 @@ func GetCurrentDirectory() string {
16
16
return strings .Replace (dir , "\\ " , "/" , - 1 )
17
17
}
18
18
19
- //get filename extensions
20
- func GetFileExt (fileName string ) string {
21
- if fileName == "" {
22
- return ""
23
- } else {
24
- index := strings .LastIndex (fileName , "." )
25
- if index < 0 {
26
- return ""
27
- } else {
28
- return string (fileName [index :])
29
- }
30
- }
31
- }
32
-
33
19
//check filename is exist
34
20
func Exist (filename string ) bool {
35
21
_ , err := os .Stat (filename )
Original file line number Diff line number Diff line change 1
1
package file
2
2
3
3
import (
4
+ "path/filepath"
4
5
"testing"
5
6
)
6
7
@@ -13,7 +14,7 @@ func Test_GetCurrentDirectory_1(t *testing.T) {
13
14
14
15
func Test_GetFileExt_1 (t * testing.T ) {
15
16
fn := "/download/vagrant_1.9.2.dmg"
16
- fileExt := GetFileExt (fn )
17
+ fileExt := filepath . Ext (fn )
17
18
if len (fileExt ) < 1 {
18
19
t .Error ("fileExt null!" )
19
20
} else {
@@ -23,7 +24,7 @@ func Test_GetFileExt_1(t *testing.T) {
23
24
24
25
func Test_GetFileExt_2 (t * testing.T ) {
25
26
fn := "/download/vagrant_1"
26
- fileExt := GetFileExt (fn )
27
+ fileExt := filepath . Ext (fn )
27
28
if len (fileExt ) < 1 {
28
29
t .Error ("fileExt null!" )
29
30
} else {
Original file line number Diff line number Diff line change 4
4
* 调整dotweb内部路由注册逻辑,New模式默认不开启,Classic模式默认开启,可通过app.UseDotwebRouter手动开启
5
5
* 修复 issue #100 , 解决特定场景下Exclude不生效问题
6
6
* Use filepath.Ext to replace file.GetFileExt, update for issue #99
7
+ * 移除 framework/file.GetFileExt 函数
7
8
* 同步更新example代码
8
9
* 2018-01-07 22:00
9
10
You can’t perform that action at this time.
0 commit comments