<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2018-08-19 16:31 GMT+02:00 Tobias Boege <span dir="ltr"><<a href="mailto:taboege@gmail.com" target="_blank">taboege@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Sun, 19 Aug 2018, Gianluigi wrote:<br>
> Hi Tobias,<br>
> one final clarification.<br>
> When you write:<br>
> "If you want access from the component code to resources in the currently<br>
> running project, then you use "../foo.txt".<br>
> gb.web.form does this, for example, to serve files in your project's<br>
> .public folder (think favicon, css and javascript resources) without you<br>
> having to think about it."<br>
> You mean that with "../" we access files in read-only mode, right?<br>
> If we need to write to the file we have to copy it to a user directory<br>
> (e.g. Try Copy "./foo.txt" To sPath &/ "foo.txt")<br>
> <br>
<br>
Yes, you should never[*] write to files in your project directory because<br>
you never know if your program might be running from an executable archive<br>
(*.gambas file) later. In that case, the project files will be bundled<br>
into the archive and the interpreter will redirect access to relative paths<br>
into that in-memory archive. There is no support for mutating the archive,<br>
neither in-memory nor on-disk. An error about the files being read-only is<br>
raised instead. This is nothing special about "..", it applies for all<br>
relative paths. The difference between "." and ".." is just in which archive<br>
components look for files.<br>
<br>
For the same reason, you can consider a program refering to files inside<br>
Application.Path to be broken[*]. If the code is packaged into an executable<br>
archive, Application.Path will be meaningless.<br>
<br>
Regards,<br>
Tobi<br>
<br>
[*] Exceptions apply, but rarely. I think there is some Gambas code<br>
out there which generates Gambas code for the project. If you know you<br>
are only ever using that functionality while developing or debugging,<br>
it's fine to write to files in your project. But otherwise, you are<br>
effectively forbidding your users from generating .gambas files.<br>
<span class="gmail-HOEnZb"><font color="#888888"><br>
-- <br>
"There's an old saying: Don't change anything... ever!" -- Mr. Monk</font></span></blockquote><div><br></div><div><br></div><div>Hi Tobias (good master),<br>Thank you very much once again.<br>Also the last doubt has vanished. 👍<br><br>Regards<br>Gianluigi <br></div></div></div></div>