Chris_Cook Posted June 23, 2013 Posted June 23, 2013 One of our ICT teachers discovered an issue on friday that scratch 1 and small basic use the same file extensions (.sb). They also found that files could get corrupted if they were opened in the wrong program. I can't reproduce this corruption though, I can't see how they managed it. Does anyone have any clever ideas to work round this? The only ways I can see are: * Ask users to right click on the file and choose open with. You could argue that that's not particularly hard, but its not a very elegant or reliable solution. * Upgrade to scratch 2 - but this is only web based at the moment. Not ideal. version 2 uses .sb2 * Write a small program to figure out what the file is before opening it in the correct program. I found code on this page to do this: Get Windows to treat files with the same extension differently - Super User I don't really want to have to maintain too many school-specific fixes like that if I can avoid it. I guess we will have to bite the bullet one way or another.
Steve21 Posted June 23, 2013 Posted June 23, 2013 Well depends what you want from the end result I guess. If you don't want to let them have the option to open it at all, you could always remove .sb from any auto-associations. e.g. Have to open it through program. As you said run a program in the middle to work it out. The other option, which is a lot "smoother" but will take more work, is edit the scratch source and put a new filetype in it. Then there's no chance of opening the wrong one unless they physically force it to. Example as per scratch forums: code: ScratchFrameMorph>>saveScratchProject fName _ (self nameFromFileName: fName), '.sb'. "Change .sb to your file extension" ScratchFrameMorph>>saveScratchProjectNoDialog (fName size = 0 | (dir fileExists: fName , '.sb') not) ifTrue: [^ self saveScratchProject]. "Again change .sb" projectName _ FileDirectory localNameFor: (fName, '.sb'). "Once again change .sb" ScratchFrameMorph>>nameFromFileName: "Add this line change .sb to your file extension also change 3 to the length of your extension" (s asLowercase endsWith: '.sb') ifTrue: [s _ s copyFrom: 1 to: s size - 3]. ScratchFileChooserDialog>>createScratchFileChooserFor:saving: list _ ScratchFilePicker new extensions: #(scratch sb). "Add your extension" Then just put an association to the new filetype to scratch etc. Or wait till summer: Will there ever be a downloadable Scratch 2.0 editor? Yep! But it won't be ready until this summer. If you'd like to help beta test it, we'll post an announcement when it's ready to try out. Steve 1
simpsonj Posted June 24, 2013 Posted June 24, 2013 We've put in a file association by year group, so for years 7 and 8, .sb opens Scratch, for year 9 it opens Small basic.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now