xbikuna / nettopologysuite

Automatically exported from code.google.com/p/nettopologysuite
0 stars 0 forks source link

Unable to open a shape file that contains ".shp" in its path. #175

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Trying to open a shape file that contains ".shp" in its path.
For example:
C:\Users\USER\shapes.shp\buildings.shp

What is the expected output? What do you see instead?
There is a FileNotFoundException:
Could not find file "c:\users\USER\shapes\buildings.dbf"

What version of the product are you using? On what operating system?
v1.13.0

Please provide any additional information below.
The problem is in the ctor of ShapefileDataReader.
line 40: filename = filename.ToLower().Replace(".shp", String.Empty);
It replaces not only the extension of the file but also parts of its path.
I recommend using Path.ChangeExtension(string path, string extension) instead.

Original issue reported on code.google.com by ronen.sc...@gmail.com on 22 Feb 2014 at 6:59

GoogleCodeExporter commented 8 years ago

Original comment by diegogu...@gmail.com on 24 Feb 2014 at 7:36

GoogleCodeExporter commented 8 years ago
added fix as you suggested with r1161, thanks for suggestion.

Original comment by diegogu...@gmail.com on 24 Feb 2014 at 8:05

GoogleCodeExporter commented 8 years ago

Original comment by diegogu...@gmail.com on 25 Feb 2014 at 8:27