diff --git a/package_test.go b/package_test.go index 0c85783..744ccd0 100644 --- a/package_test.go +++ b/package_test.go @@ -461,7 +461,7 @@ func TestCommandLineArgumentsPagkageDetection(t *testing.T) { }{ {"x_cgo_sys_thread_creater", ".", ClassSTD}, {"_cgo_sys_thread_star", ".", ClassSTD}, - {"", ".", ClassGenerated}, + {"", "", ClassGenerated}, {"gopackage", "gopackage", ClassMain}, {"gopackage/subpackage", "gopackage/subpackage", ClassMain}, } diff --git a/utils.go b/utils.go index a86ed38..fa0d6d6 100644 --- a/utils.go +++ b/utils.go @@ -5,16 +5,26 @@ package gore import ( "path/filepath" + "strings" ) func osAwarePathDir(s string) string { - return filepath.Dir(s) + if strings.Contains(s, "/") { + return filepath.Dir(s) + } + return s } func osAwarePathBase(s string) string { - return filepath.Base(s) + if strings.Contains(s, "/") { + return filepath.Base(s) + } + return s } func osAwarePathClean(s string) string { - return filepath.Clean(s) + if strings.Contains(s, "/") { + return filepath.Clean(s) + } + return s }