Re: Open File Error?
Daniel Diaz <[email protected]> Fri, 23 Oct 2009 10:14:34 +0200
| Newsgroups | gmane.comp.gnu.prolog.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello, this problem comes from the fact under Windows the \ char is the separator inside pathnames. Most built-in predicates handling file names call absolute_file_name/2 which computes the absolute path (resolving for instance variable substitutions, relative path like .\ and ..\, etc). Since gprolog does not yet handle wide chars when it sees a \ it treats it as a separator. Until such an extension is done there is no "clean" way to solve this. However, I'd like to provide a "not too dirty" workaround for the special case of pathnames. The easiest way I see to fix this is to use an enviroment variable (or a Windows register key) to indicate if a \ preceded by a char >= 128 is not a separator. What do you think ? Daniel Yasuhisa Matsumura wrote: Dear Prof. Daniel Diaz and other GNU-Prolog developers! Thank you very much for your splendid Prolog compiler. I would like to report the following 'BUG' (or 'Short-coming') under Windows OS. I would be very glad as a Japanese user, if you could fix it some time. Thank you very much, again. Yasuhisa Matsumura [email protected] OS: Windows Vista GNU-Prolog version: 1.3.1 The Japanese Windows system encoding (= Shift_JIS) includes such a 2-byte character: '\x95\\\' i.e. name('\x95\\\',[149,92]). %%%%%%%%%%%%%%%%%%%%% But you can NOT open the file with the file name '\x95\\\.txt', for example, test(C) :- see('\x95\\\.txt'),get0(C),seen. uncaught exception: error(existence_error(source_sink,'\x95\\\.txt'),see/1) %%%%%%%%%%%%%%%%%%%%%%%%% In contrast, you CAN open the file with the file name '\x95\[.txt' i.e. name('\x95\[',[149,91]). test(C) :- see('\x95\[.txt'), get0(C), seen. C = 97 in case you wrote the character 'a' in the file. %%%%%%%%%%%%%%%% PS. The characters have the following appearance on Windows system: '\x95\\\' = '表'. '\x95\[' = '票'. But I think you cannot view the character appearance on your French or English Operating System. -- Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé. ---------- _______________________________________________ Bug-prolog mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-prolog -- Ce message a été vérifié par MailScanner pour des virus ou des polluriels et rien de suspect n'a été trouvé. _______________________________________________ Bug-prolog mailing list [email protected] http://lists.gnu.org/mailman/listinfo/bug-prolog