bopen / elevation

Python script to download global terrain digital elevation models, SRTM 30m DEM and SRTM 90m DEM.
http://elevation.bopen.eu
Apache License 2.0
290 stars 74 forks source link

mkdir -p not working on windows #40

Open chahank opened 4 years ago

chahank commented 4 years ago

The elevation package can create problems on Windows machine because the command 'mkdir -p' does not work. It should be replaced by 'mkdir'. Recursivity (flag p) is natively included in 'mkdir' on Windows.

One quick and dirty solution would be to modify 'datasource.mk' and check if the OS is Windows, in which case the code should use 'mkdir' , else 'mkdir -p'.

Could the developers please comment whether there is any argument speaking against such a change?

chahank commented 4 years ago

Is there still anyone active on this repository?

alexamici commented 4 years ago

I'm sorry the tools has been design to work on Linux/MacOS/Unix and I never tested it on Windows. It may work using the Windows Subsystem for Linux (WSL), but it is not supported.

chahank commented 4 years ago

Thanks for the reply! That is what we figured out. We tested the package quite a bit also on Windows and found that:

However,

This could be easily solved by using mkir from windows directly, but this must be done without the -p flag (the windows mkdir applied the flag implicitly). Hence, a simple solution to make the package usable would be to add an if statement to use mkdir instead of mkdir -p when the system is windows.

gdt commented 4 years ago

You might consider filing a bug with windows that it is not implementing the -p option which is required by POSIX: https://pubs.opengroup.org/onlinepubs/9699919799/

While that seems hard, it would probably make a lot of things work better on Windows if it were fixed.

chahank commented 4 years ago

Thanks for the idea. However, I do not think this would quickly fix the problem (if it is done at all).