Ops, I'll try under DOS...

On Tuesday, June 14, 2016 at 1:11:44 PM UTC-4, Tong Sun wrote:
>
> Like this? -- https://play.golang.org/p/jhK-vmmmdH
>
> package main
>
>
> import (
>  "fmt"
>  "path/filepath"
> )
>
>
> func main() {
>  fmt.Println(filepath.Base("/a/b.c"))
>  fmt.Println(filepath.Base(`C:\Program Files\Microsoft Visual Studio 
> 9\Common7\IDE\devenv.exe`))
> }
>
>
> The output is still exactly the same as before. 
>
>
> On Tuesday, June 14, 2016 at 1:01:18 PM UTC-4, Jan Mercl wrote:
>>
>> Package path is for *nix paths only. import "path/filepath" instead.
>>
>> On Tue, Jun 14, 2016, 18:55 Tong Sun <sunto...@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...@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.

Reply via email to