How do I set the file path in Android?

adder, created Jun 02. 2016 I do not understand how to set a proper filepath for the development program. For example, I enter sys_add_path('storage/emulated/0/projects/'). but when I try to load a prolog file, it is not found. I wonder if I do not understand how file paths work in Android. Please help.

Comments

Re: How do I set the file path in Android?

adder, created Jun 04. 2016 This helped very much! Thanks you!

Re: How do I set the file path in Android?

Jan Burse, created Jun 03. 2016 Hi, Please consider improving using sys_add_path/1 as follows: 1) You can either provide a relative or an absolute path. If you provide a relative path it will be resolved against the base_url Prolog flag. But here I guess you want to provide an absolute path. An absolute path must begin with a slash (/). So try the following for example: ?- sys_add_path('/storage/emulated/0/projects/'). You can check what path effectively was set as follows: ?- sys_current_path(X). X = ... 2) After you have set a path, you can load files relative to this path. But to tell the Prolog system that you are now loading relatively to the class path, you need to use the library/1 constructor. So if you want for example load a file "bar.p" that is in a directory "foo" relative to your class path, you can do this as follows: ?- [library(foo/bar)]. 3) These links might be also useful: Two useful apps in connection with Jekejeke for Android: http://plus.google.com/+JekejekeCh/posts/WwaCBBpoYQ9 Setting a Path in Jekejeke for Android: http://plus.google.com/+JekejekeCh/posts/AjHPCgdb8xS Hope this helps. Bye