haifengl / smile

Statistical Machine Intelligence & Learning Engine
https://haifengl.github.io
Other
5.99k stars 1.12k forks source link

fix test data path #706

Closed rayeaster closed 2 years ago

rayeaster commented 2 years ago

It might help to add /data sub-folder in default system property value directly instead using string concatenation later. And plain string concatenation would encounter path seperator issue across platforms like Linux(using /) and Windows (using \\ in Java).

For example, in Windows, with proposed change, developer could run the unit test with java option -Dsmile.home=C:\smile\shell\src\universal\data to override the default value

haifengl commented 2 years ago

Thanks. But it will breaks the semantics of smile.home that should point to the top directory of installation. This may cause issues with smile shell where smile.home is set in the startup script.

rayeaster commented 2 years ago

Thanks. But it will breaks the semantics of smile.home that should point to the top directory of installation. This may cause issues with smile shell where smile.home is set in the startup script.

how about introduce another variable specific for testing data like smile.data so it could avoid string concatenation and keep existing smile.home semantic intact

haifengl commented 2 years ago

Try this for line 40

return java.nio.file.Paths.get(home + File.separator + "data", path);

It should be platform independent.

rayeaster commented 2 years ago

Try this for line 40

return java.nio.file.Paths.get(home + File.separator + "data", path);

It should be platform independent.

It works and PR updated accordingly

haifengl commented 2 years ago

Thanks!