Re: [go-nuts] Re: looking for a flexible file path resolver

2018-08-07 Thread Marvin Renich
* DrGo [180806 18:37]: > There are situations where you need to check (and report back to the user) > for file existence no matter how you do that (using Stat or by attempting > to open or create it). I agree completely. However, doesn't os.Stat do what you want here simply and portably? If

Re: [go-nuts] Re: looking for a flexible file path resolver

2018-08-06 Thread DrGo
Thanks Marvin, There are situations where you need to check (and report back to the user) for file existence no matter how you do that (using Stat or by attempting to open or create it). There are several issues with the approach you described, which is essentially what fileapth.Abs() does, som

Re: [go-nuts] Re: looking for a flexible file path resolver

2018-08-06 Thread Marvin Renich
* DrGo [180806 02:00]: > Thanks, > filepath.Abs does some of what I want, but as far as I could tell, it does > not handle resolving relative paths Does this code help out? if filepath.IsAbs(somepath) { somepath = filepath.Clean(somepath) } else { var wd, err = os.Getwd() if err !=

[go-nuts] Re: looking for a flexible file path resolver

2018-08-05 Thread DrGo
Thanks, filepath.Abs does some of what I want, but as far as I could tell, it does not handle resolving relative paths On Sunday, August 5, 2018 at 11:12:37 PM UTC-5, Behrad Khodayar wrote: > > Have you tried filepath package > from path

[go-nuts] Re: looking for a flexible file path resolver

2018-08-05 Thread Behrad Khodayar
Have you tried filepath package from path . It handles such things based on OS & etc. Hope it helps On Monday, 6 August 2018 06:49:15 UTC+4:30, DrGo wrote: > > In many applications, I need to resolve an arbitrary file name tha