gama-platform / gama.old

Main repository for developing the 1.x versions of GAMA
GNU General Public License v3.0
304 stars 99 forks source link

File with Absolute path does not work #2456

Closed hqnghi88 closed 6 years ago

hqnghi88 commented 6 years ago

Steps to reproduce

1. Try to declare a file withe abslute path, like: file parcels_shapefile <- file("file:\D:\Downloads\AWP2018\binhthanh_village_scale\parcels_binhthanh_village.shp");

2. Launch simulation 3.

Expected behavior

NO exception and file read. It should relate with gama-platform/gama2#14 once we can use prefix for any file outside of gama project (file://, platform://, url://)

Actual behavior

Exception: File denoted.....

System and version

Gama git

AlexisDrogoul commented 6 years ago

The title of the issue is misleading. Absolute file names work perfectly (eg, I tried something like file shape_file_buildings <- shape_file('/Users/drogoul/Documents/Git/gama/msi.gama.models/models/Features/3D Visualization/includes/building.shp', 0); and it opened without problems). Only the ones prefixed by a protocol are not yet accepted. This effectively relates to gama-platform/gama2#14 so I close this issue.

hqnghi88 commented 6 years ago

Sorry, i dont want to mislead , i forget to remove the file:// (protocol) . Actually , on windows, i cant make it work with absolute path, file parcels_shapefile <- file("C:/Users/hqngh/OneDrive/Gama1.7/JTD_2017/includes/binhthanh_village_scale/parcels_binhthanh_village.shp"); nor file parcels_shapefile <- file("C://Users//hqngh//OneDrive//Gama1.7//JTD_2017//includes//binhthanh_village_scale//parcels_binhthanh_village.shp");

I tried ubuntu and it work as same as your unix.

hqnghi88 commented 6 years ago

and this also dont work file parcels_shapefile <- file("C:\Users\hqngh\OneDrive\Gama1.7\JTD_2017\includes\binhthanh_village_scale\parcels_binhthanh_village.shp");

hqnghi88 commented 6 years ago

neither adding ,0 as in your example file parcels_shapefile <- shape_file("C:/Users/hqngh/OneDrive/Gama1.7/JTD_2017/includes/binhthanh_village_scale/parcels_binhthanh_village.shp",0);

AlexisDrogoul commented 6 years ago

I've made a small modification (using the new Paths API from Java 7 or 8) that seems to work in both macOS and Windows. Can you check the commit once it has been made ?

hqnghi88 commented 6 years ago

It works. But i cant Open Declaration from right click, or F3, to open an absolute declared file. Do we consider it as an issue or documente it , may be it relate to some priviledge on win os?

AlexisDrogoul commented 6 years ago

Can you try with the latest commit ?

hqnghi88 commented 6 years ago

It works. Thank you very much.