[squeak-dev] [BUG] ERROR: File not in Directory: [...]
while trying to create a SAR-archive on Windows
David T. Lewis
lewis at mail.msen.com
Sat Jan 24 02:00:52 UTC 2015
OK good. I tried it on Unix with your original example code, and that works
also. I will move the update from inbox to trunk.
Thanks,
Dave
On Sat, Jan 24, 2015 at 02:53:20AM +0100, Tim Oesterreich wrote:
> Hi Dave,
>
> this did fix the problem. (Tested on Windows. I'm assuming it doesn't
> suddenly crash on Unix now ;) )
>
> Thank you!
>
> Tim
>
> -----Urspr?ngliche Nachricht-----
> Von: squeak-dev-bounces at lists.squeakfoundation.org
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] Im Auftrag von David
> T. Lewis
> Gesendet: Saturday, 24 January, 2015 1:43
> An: The general-purpose Squeak developers list
> Betreff: Re: [squeak-dev] [BUG] ERROR: File not in Directory: [...] while
> trying to create a SAR-archive on Windows
>
> Hi Tim and Tobias,
>
> I put a proposed fix for this in the inbox.
>
> The update is:
>
> ZipDirectoryMember>>localFileName: aString
> | dir entry parent fsPath |
> super localFileName: aString.
> fileName last = $/ ifFalse: [ fileName := fileName, '/' ].
> parent := FileDirectory default.
> aString last = parent pathNameDelimiter
> ifTrue: [fsPath := parent fullNameFor: aString]
> ifFalse: [fsPath := parent fullNameFor: aString, parent
> slash].
> (parent directoryExists: fsPath) ifTrue: [
> dir := FileDirectory on: fsPath.
> entry := dir directoryEntry.
> self setLastModFileDateTimeFrom: entry modificationTime
> ]
>
>
> This separates the host file system test (Windows in the case) from the path
> naming in the zip archive. It also expands the path name to be fully
> qualified ("C:\foo\bar" not just "bar") because this is important on Windows
> and also should work on Unix.
>
> Please give this a try and see if it solves the problem for you. If nobody
> complains, I'll move it to trunk in a day or so.
>
> Dave
>
>
>
> On Thu, Jan 22, 2015 at 09:22:25PM +0100, Tim Oesterreich wrote:
> > Hello all,
> >
> >
> >
> > |package folder|
> >
> >
> >
> > "Name of the Monticello-package that should be archived"
> >
> > package := 'SWAProject'.
> >
> > "Name of the resources folder in Contents/Resources/"
> >
> > folder := 'SWA-Resources'.
> >
> >
> >
> > zip := ZipArchive new.
> >
> > mczStream := RWBinaryOrTextStream on: (String new: 10000).
> >
> > workingCopy := MCWorkingCopy forPackage: (MCPackage new name: package).
> >
> > version := workingCopy newVersion fileOutOn: mczStream.
> >
> > (zip addString: mczStream contents as: package, '.mcz')
> > desiredCompressionLevel: 0.
> >
> > zip addTree: Smalltalk imagePath match: [:e | e fullName startsWith:
> >
> > Smalltalk imagePath , FileDirectory slash , folder].
> >
> > zip addString: 'self fileInMonticelloZipVersionNamed: ''' , package,
> > '.mcz''.
> >
> > (self membersMatching: ''' , folder , FileDirectory slash , '*.*'')
> > do: [ :f
> > | self
> >
> > extractMember: f].' as: 'install/preamble'.
> >
> > zip writeToFileNamed: package , '.sar'.
> >
> >
> >
> > This code should create a SAR-Archive from a Monticello-Package
> > including all resources in the specified folder
> >
> > However it throws the error "File not in Directory: SWA-Resources#" on
> > a Windows-System, while working fine on a Mac.
> >
> > It seems like there is an issue with the handling of
> > platform-dependent directory seperators (\ on Windows, / on UNIX).
> >
> >
> >
> > Best
> >
> > -Tim
> >
> >
> >
>
> >
>
>
>
More information about the Squeak-dev
mailing list
|