• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: fileHandle writeData not reporting error nor writing data
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fileHandle writeData not reporting error nor writing data


  • Subject: Re: fileHandle writeData not reporting error nor writing data
  • From: Ken Hawkins <email@hidden>
  • Date: Tue, 23 Mar 2004 15:07:52 -0800

found it! it can write to a file but cannot create a directory structure for it as well. the directory 'The Mask & the Mirror' was not there and so it did not report an error when it tried to write the file out. is this a bug?

ken;
On Mar 23, 2004, at 2:37 PM, Ken Hawkins wrote:

The following bit of code is what is not returning an erro nor writing
the file:

NSEnumerator *deviceEnumerator = [[value mediaList:YES]
objectEnumerator];
XMTrack * track = nil;
NSData * buffer = nil;
NSString * dest = nil;
NSFileHandle * outFile = nil;

while ((track = [deviceEnumerator nextObject]) != nil)
{
NSString * outDir = [NSString stringWithFormat:@"%@/%@", [self
fileDirectory], [value volumeName]];
// now we go through and extract the files
// redundant select check here
if([track isSelected])
{
dest = [NSString stringWithFormat:@"%@/%@.%@", outDir, [track name],
[self fileExtension]];
outFile = [NSFileHandle fileHandleForWritingAtPath:dest];

if(outFile = nil)
{
[log toLog:self level:kLOG_ERROR message:
[NSString stringWithFormat:@"failed to open %@",
dest]];
return;
}

[log toLog:self level:kLOG_DEBUG message:
[NSString stringWithFormat:@"xtracting %@ to %@",
[track name], dest]];

//get the buffer
buffer = [[track mediaHandle] readDataToEndOfFile];

if([buffer length] > 0)
{
[outFile writeData:buffer];

[log toLog:self level:kLOG_DEBUG message:
[NSString stringWithFormat:@"xtracte %@ with length of %i",
dest, [buffer length]]];
}

[[track mediaHandle] closeFile];
[outFile closeFile];

break;
}
}

i can go all the way through here and the debug stuff comes out as:

2004-03-23 14:33:28.448 CDXtractor[905] DEBUG xtracting Mystic's Dream
to /Users/ken/downloads/The Mask & The Mirror/Mystic's Dream.mp3
2004-03-23 14:34:08.173 CDXtractor[905] DEBUG xtracte
/Users/ken/downloads/The Mask & The Mirror/Mystic's Dream.mp3 with
length of 81475632

this is the correct length but there is no file created. does
'fileHandleForWritingAtPath' NOt return nil if a file is not found? the
outFile is supposed to be a newly created file.

thanks,
ken;
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: fileHandle writeData not reporting error nor writing data
      • From: Ondra Cada <email@hidden>
References: 
 >fileHandle writeData not reporting error nor writing data (From: Ken Hawkins <email@hidden>)

  • Prev by Date: Re: how to make my plugin appears like a package ?
  • Next by Date: Converting a string to a number
  • Previous by thread: fileHandle writeData not reporting error nor writing data
  • Next by thread: Re: fileHandle writeData not reporting error nor writing data
  • Index(es):
    • Date
    • Thread