ruby on rails - Why do I get "Errno::ENOENT: No such file or directory" when joining a filename? -


i have file i'm trying open in rails application. reason ruby splitting name of file.

for example:

root = rails.root path = root.join('lib/tasks/filename.shp') puts path 

what output /lib/tasks/filename/shp.

then run command:

factory = region::geofactory rgeo::shapefile::reader.open(path, :factory => factory) |file| 

i error message:

errno::enoent: no such file or directory - /lib/tasks/filename/.shp 

it looks file has been split filename , .shp?

try

path = file.join(rails.root, 'lib/tasks/filename.shp') factory = region::geofactory rgeo::shapefile::reader.open(path, :factory => factory) 

Comments