[squeak-dev] [BUG] ERROR: File not in Directory: [...] while trying to create a SAR-archive on Windows

Tobias Pape Das.Linux at gmx.de
Thu Jan 22 23:29:16 UTC 2015


Hi

previously today I debugged the error together with Tim.
The culprit seems to be in 

ZipDirectoryMember>>localFileName: aString
1	| dir entry parent |
2	super localFileName: aString.
3	fileName last = $/ ifFalse: [ fileName := fileName, '/' ].
4	parent := FileDirectory default.
5	(parent directoryExists: fileName) ifTrue: [
6		dir := FileDirectory on: (parent fullNameFor: fileName).
7		entry := dir directoryEntry.
8		self setLastModFileDateTimeFrom: entry modificationTime
9	]

the problematic messages are #directoryExists: (5) and #fullNameFor: (6),
because on Windows, `parent` is a DosFileDirectory (w/ pathDelemiter == $\)
but line 3 and super (2, ArchiveMember>>#localFileName: (super of ZipDirectoryMember)
force $/ at the end of the string.

ArchiveMember>>localFileName: aString
	"Set my internal filename.
	Returns the (possibly new) filename.
	aString will be translated from local FS format into Unix format."

	^fileName := aString copyReplaceAll: FileDirectory slash with: '/'.

so, if `aString` above is 'Resources', it is forced to be

'Resources/', which DosFileDirectory “sanitizes” to 'Resources#', which does
not exists...

Best
	-Tobias



On 23.01.2015, at 00:02, Tim Oesterreich <tim.oesterreich at student.hpi.de> wrote:

> No that’s not it.
> The error occurs at 
>                 “zip addTree:match:”
>  
> Von: squeak-dev-bounces at lists.squeakfoundation.org [mailto:squeak-dev-bounces at lists.squeakfoundation.org] Im Auftrag vongettimothy
> Gesendet: Thursday, 22 January, 2015 23:23
> 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
>  
> W/o testing it, I noticed that you have a forward slash in 
>  
>  
> FileDirectory slash , '*.*'') do: [ :f | self
> 
>   extractMember: f].' as: 'install/preamble'.  <---------------------should this be FileDirectory slash? 
>  
> cheers
>  
> 
> ---- On Thu, 22 Jan 2015 15:22:25 -0500 Tim Oesterreich <tim.oesterreich at student.hpi.de> 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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1625 bytes
Desc: Message signed with OpenPGP using GPGMail
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20150123/4beb93be/signature.pgp


More information about the Squeak-dev mailing list