spf13 / afero

A FileSystem Abstraction System for Go
Apache License 2.0
5.8k stars 498 forks source link

MemMapFs paths are reported as being on the actual system OS #347

Open maxiride opened 2 years ago

maxiride commented 2 years ago

I just discovered afero and tried the in memory filesystem, upon playing with these two lines of code below I noticed that the reported path of the temporary files is on my local machine:

C:\Users\federico.d\AppData\Local\Temp\108673950

(property afero.File.fileData.name)

However, the file doesn't actually exist on the OS.

memFS := afero.NewMemMapFs()
temp1, _ := afero.TempFile(memFS, "", "")

This isn't at all an issue, I suppose, but it raised concerns on me when I was about to execute a RemoveAll on a path.

Is this the expected behaviour and if so why mimicking real OS paths?

e200 commented 1 year ago

No, it is not the expected behavior and is making it hard for me to do unit tests using the InMemory storage