<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On 21.09.2010, at 03:39, Alberto Arruda de Oliveira wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hello,<br><br>I've been adapting an application to use as an activity, and I have some questions about the way to save on sugar.<br><br>At first, I tried to just create a directory inside my Activity folder especially made for saving files, but it did not work, because of the access permissions to it, and, although we could simply manually change the folder permission for writing on that folder, we would have to do it for every single OLPC we installed our activity into and we didn't want that. <br>
<br>Then, we started trying with the journal. Everything was going fine, until we discovered that another sugar activity, Scratch, implemented saving and loading on a similar fashion we previously wanted. It has a folder inside it's Activity directory with subdirectories related to each kind of Scratch project. Also, Scratch's Activity directory has the same access permission as any other sugar Activity installed.<br>
<br>So, my question is, does anyone knows how Scratch implements it's save / loading method? is there any guide explaining how to do it without using the journal? Keep in mind that we do know that there are other directories we could use to save our files, but we would like to use our Activity directory if possible.<br></blockquote><br></div><div>You cannot.</div><div><br></div><div>Scratch used to copy all the files from the bundle directory to the writable directory (the "data" directory in SUGAR_ACTIVITY_ROOT). This happened in its startup wrapper script. It tested for the existence of the copied folder, and if it was not there (that is, the activity was run the first time), did the copying.</div><div><br></div><div><a href="http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#File_Access">http://wiki.sugarlabs.org/go/Development_Team/Low-level_Activity_API#File_Access</a></div><div><br></div><div><div><div>As others have pointed out, the newest Scratch version stores into and loads from the Journal. It does not copy from the bundle anymore. For loading examples it still shows the files in the bundle, but they are read-only now. You can only save to the Journal. </div></div><div><br></div></div><div><div style="font-family: Helvetica; font-size: 12px; ">- Bert -</div></div><br></body></html>