On Tue, Jun 14, 2016 at 10:00 AM, Jan Mercl <0xj...@gmail.com> wrote:
> Package path is for *nix paths only. import "path/filepath" instead.

I agree that path/filepath is what you want, but I would say it
slightly differently.  path is for what you find inside URLs,
path/filepath is for paths in the file system on both Unix and
Windows.

Ian

> On Tue, Jun 14, 2016, 18:55 Tong Sun <suntong...@gmail.com> wrote:
>>
>> I thought to get basename, we should use the official path.Base --
>> https://golang.org/pkg/path/#Base
>>
>> However, I just found out that it is not working under DOS --
>> https://play.golang.org/p/kfr0N50JWc
>>
>> package main
>>
>>
>> import (
>>  "fmt"
>>  "path"
>> )
>>
>>
>> func main() {
>>  fmt.Println(path.Base("/a/b.c"))
>>  fmt.Println(path.Base(`C:\Program Files\Microsoft Visual Studio
>> 9\Common7\IDE\devenv.exe`))
>> }
>>
>>
>> The output is:
>>
>> b.c
>> C:\Program Files\Microsoft Visual Studio 9\Common7\IDE\devenv.exe
>>
>>
>> What's your solution for this, that is working for both Linux and Windows?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "golang-nuts" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
>
> -j
>
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to