This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-10-21 12:11:02

jvvg
Scratcher
Registered: 2008-03-26
Posts: 1000+

Full location of a file

How do I find the FULL path to the current project in ScratchFrameMorph?


http://tiny.cc/zwgbewhttp://tiny.cc/e1gbewhttp://tiny.cc/zygbewhttp://tiny.cc/izgbew
Goodbye, Scratch 1.4  sad                                                        Hello Scratch 2.0!  smile

Offline

 

#2 2012-10-21 12:16:49

nXIII
Community Moderator
Registered: 2009-04-21
Posts: 1000+

Re: Full location of a file

ScratchFrameMorph ›› saveScratchProjectNoDialog
    | fName dir |
    self closeMediaEditorsAndDialogs ifFalse: [^ self].

    projectName ifNil: [projectName _ ''].
    fName _ self nameFromFileName: projectName.

    dir _ ScratchFileChooserDialog getLastFolderForType: #project.

    (fName size = 0 | (dir fileExists: fName , '.sb') not) ifTrue: [^ self saveScratchProject].
    ScratchFileChooserDialog lastFolderIsSampleProjectsFolder ifTrue:  [^ self saveScratchProject].

    self updateLastHistoryEntryIfNeeded.

    projectName _ FileDirectory localNameFor: (fName, '.sb').
  "ignore path, if any; save in the original project directory"
    projectDirectory _ dir.

    self updateHistoryProjectName: projectName op: 'save'.
    self writeScratchProject.

Last edited by nXIII (2012-10-21 13:15:20)


nXIII

Offline

 

Board footer