Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread JanakiRam
Hi All,
I'm facing an issue with NSFileManger directoryContentsAtPath API. This
seems to be an wried issue. But its very important for me to fix. Please
help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by Finder and
Terminal in a different ways. Can any one please suggest me a way to resolve
this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@"/Users/janakiram/Downloads/Folder.tiff"];
int i , count = [filePath count];

for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/Folder.tiff

Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M




JanakiRam.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread Jean-Daniel Dupas

"Icon\r" is an invisible file that contains a custom directory icon.

What make you think this file is handle in different way ?
The terminal displays '\r' as ^M but it's not a problem. Isn't it?


Le 15 mai 08 à 12:17, JanakiRam a écrit :


Hi All,
I'm facing an issue with NSFileManger directoryContentsAtPath API.  
This
seems to be an wried issue. But its very important for me to fix.  
Please

help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@"/Users/janakiram/Downloads/Folder.tiff"];
int i , count = [filePath count];

for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/ 
Folder.tiff


Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M




JanakiRam.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread Graham Cox

How do the two outputs differ from your expectations?

G.


On 15 May 2008, at 8:17 pm, JanakiRam wrote:


But its very important for me to fix. Please
help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread Michael Vannorsdel
This has to do with non-printable characters in pathnames.  Each  
application can different how they visually represent these  
characters.  The terminal just replaces them with '?', the Finder  
might use a space.


When you have a path from NSFileManager, leave it as is in the  
NSString if you're going to pass it to other Foundation file manager  
APIs.  If you need a C string of the path for C APIs, you can use  
NSFileManager's fileSystemRepresentationWithPath: to get a properly  
encoded C string.  Also displayNameAtPath: can give you the proper  
representation for displaying the path to the user but may not work  
when passed to file system APIs.



On May 15, 2008, at 4:17 AM, JanakiRam wrote:

I'm facing an issue with NSFileManger directoryContentsAtPath API.  
This
seems to be an wried issue. But its very important for me to fix.  
Please

help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@"/Users/janakiram/Downloads/Folder.tiff"];
int i , count = [filePath count];

for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/ 
Folder.tiff


Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread JanakiRam
When i perform ls command it shows file name as "Icon?". When i perform cp
command & tab it shows the file name as "Icon^M".
Why Terminal does show different  names for the same file. When i see it in
Finder it does show as "Icon".

Please advise. Thanks in Advance.

JanakiRam

On Thu, May 15, 2008 at 4:34 PM, Jean-Daniel Dupas <[EMAIL PROTECTED]>
wrote:

> "Icon\r" is an invisible file that contains a custom directory icon.
>
> What make you think this file is handle in different way ?
> The terminal displays '\r' as ^M but it's not a problem. Isn't it?
>
>
> Le 15 mai 08 à 12:17, JanakiRam a écrit :
>
>  Hi All,
>> I'm facing an issue with NSFileManger directoryContentsAtPath API. This
>> seems to be an wried issue. But its very important for me to fix. Please
>> help me.
>>
>> My application is trying to enumerate  the folders in inside a Mac
>> using NSFileManager  API. But for some files its failing.
>>
>> It looks like the file name ( inside bundle ) is interpreted by Finder and
>> Terminal in a different ways. Can any one please suggest me a way to
>> resolve
>> this issue.
>>
>> Thanks in Advance
>>
>> *Cocoa Code for your reference.*
>>
>> NSFileManager *defaultManager = [NSFileManager defaultManager];
>> NSArray *filePath = [defaultManager directoryContentsAtPath:
>> @"/Users/janakiram/Downloads/Folder.tiff"];
>> int i , count = [filePath count];
>>
>> for ( i = 0 ; i < count ; i++ ) {
>> NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);
>>
>> }
>>
>> *Output:*
>>
>> [Session started at 2008-05-15 15:34:38 +0530.]
>> 2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
>> )
>>
>> FileEnumerator has exited with status 0.
>>
>> *Terminal View of Folder :*
>>
>> Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/Folder.tiff
>>
>> Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
>> total 112
>> drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
>> drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
>> -rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?
>>
>> Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M
>>
>>
>>
>>
>> JanakiRam.
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org
>>
>> This email sent to [EMAIL PROTECTED]
>>
>>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Jean-Daniel Dupas

Yes, they all display it in a different way, and why is it a problem ?

What does it prevent you to do?



Le 16 mai 08 à 07:02, JanakiRam a écrit :

When i perform ls command it shows file name as "Icon?". When i  
perform cp command & tab it shows the file name as "Icon^M".


Why Terminal does show different  names for the same file. When i  
see it in Finder it does show as "Icon".


Please advise. Thanks in Advance.

JanakiRam

On Thu, May 15, 2008 at 4:34 PM, Jean-Daniel Dupas <[EMAIL PROTECTED] 
> wrote:

"Icon\r" is an invisible file that contains a custom directory icon.

What make you think this file is handle in different way ?
The terminal displays '\r' as ^M but it's not a problem. Isn't it?


Le 15 mai 08 à 12:17, JanakiRam a écrit :

Hi All,
I'm facing an issue with NSFileManger directoryContentsAtPath API.  
This
seems to be an wried issue. But its very important for me to fix.  
Please

help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@"/Users/janakiram/Downloads/Folder.tiff"];
int i , count = [filePath count];

for ( i = 0 ; i < count ; i++ ) {
NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/ 
Folder.tiff


Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M




JanakiRam.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

This email sent to [EMAIL PROTECTED]





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Hamish Allan
On Fri, May 16, 2008 at 6:02 AM, JanakiRam <[EMAIL PROTECTED]> wrote:
> When i perform ls command it shows file name as "Icon?". When i perform cp
> command & tab it shows the file name as "Icon^M".
> Why Terminal does show different  names for the same file.

Because the filename contains a non-printing character
(http://en.wikipedia.org/wiki/Control_character). "bash" (which is
what is performing the tab completion) and "ls" have different ways of
denoting non-printing characters. NSLog is treating it as if there is
an implicit line feed.

> When i see it in
> Finder it does show as "Icon".

This would suggest that the Finder has been designed not to indicate
the presence of non-printing characters.

> Please advise. Thanks in Advance.

Advise you about what, though? You say that "for some files it is
failing", but the code you included seems to be working perfectly.

Hamish
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread JanakiRam
When i give this filename as part of rsync source file ( using --files-from
) , rsync is treating this filename as 2 different file names , because
rsync expects each filen name separated by \r.
Hence my rsync command is failing

JanakiRam.


On Fri, May 16, 2008 at 5:42 PM, Jean-Daniel Dupas <[EMAIL PROTECTED]>
wrote:

> Yes, they all display it in a different way, and why is it a problem ?
> What does it prevent you to do?
>
>
>
> Le 16 mai 08 à 07:02, JanakiRam a écrit :
>
> When i perform ls command it shows file name as "Icon?". When i perform cp
> command & tab it shows the file name as "Icon^M".
> Why Terminal does show different  names for the same file. When i see it in
> Finder it does show as "Icon".
>
> Please advise. Thanks in Advance.
>
> JanakiRam
>
> On Thu, May 15, 2008 at 4:34 PM, Jean-Daniel Dupas <[EMAIL PROTECTED]>
> wrote:
>
>> "Icon\r" is an invisible file that contains a custom directory icon.
>>
>> What make you think this file is handle in different way ?
>> The terminal displays '\r' as ^M but it's not a problem. Isn't it?
>>
>>
>> Le 15 mai 08 à 12:17, JanakiRam a écrit :
>>
>>  Hi All,
>>> I'm facing an issue with NSFileManger directoryContentsAtPath API. This
>>> seems to be an wried issue. But its very important for me to fix. Please
>>> help me.
>>>
>>> My application is trying to enumerate  the folders in inside a Mac
>>> using NSFileManager  API. But for some files its failing.
>>>
>>> It looks like the file name ( inside bundle ) is interpreted by Finder
>>> and
>>> Terminal in a different ways. Can any one please suggest me a way to
>>> resolve
>>> this issue.
>>>
>>> Thanks in Advance
>>>
>>> *Cocoa Code for your reference.*
>>>
>>> NSFileManager *defaultManager = [NSFileManager defaultManager];
>>> NSArray *filePath = [defaultManager directoryContentsAtPath:
>>> @"/Users/janakiram/Downloads/Folder.tiff"];
>>> int i , count = [filePath count];
>>>
>>> for ( i = 0 ; i < count ; i++ ) {
>>> NSLog(@" filepath  is (%@)",[filePath objectAtIndex:i]);
>>>
>>> }
>>>
>>> *Output:*
>>>
>>> [Session started at 2008-05-15 15:34:38 +0530.]
>>> 2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
>>> )
>>>
>>> FileEnumerator has exited with status 0.
>>>
>>> *Terminal View of Folder :*
>>>
>>> Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/Folder.tiff
>>>
>>> Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
>>> total 112
>>> drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
>>> drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
>>> -rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?
>>>
>>> Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M
>>>
>>>
>>>
>>>
>>> JanakiRam.
>>> ___
>>>
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org
>>>
>>> This email sent to [EMAIL PROTECTED]
>>>
>>>
>>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Hamish Allan
On Fri, May 16, 2008 at 3:28 PM, JanakiRam <[EMAIL PROTECTED]> wrote:

> When i give this filename as part of rsync source file ( using --files-from
> ) , rsync is treating this filename as 2 different file names , because
> rsync expects each filen name separated by \r.
> Hence my rsync command is failing

You need to quote the filename you pass to rsync. How are you passing it?

Hamish
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Jens Alfke


On 16 May '08, at 7:28 AM, JanakiRam wrote:

When i give this filename as part of rsync source file ( using -- 
files-from
) , rsync is treating this filename as 2 different file names ,  
because

rsync expects each filen name separated by \r.


Then it sounds like the author of rsync didn't take into account that  
there might be control characters in filenames. You'll have to find a  
way to work around that. Maybe there's a different way to pass the  
filenames to rsync, or a way to specify a different delimiter.


Either way, this is an rsync issue, not a Cocoa one, so please take it  
elsewhere (an rsync forum, or possibly the darwin-userlevel list here.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Re: Problem with NSFileManger directoryContentsAtPath

2008-05-16 Thread Michael Vannorsdel

How are you invoking rsync?  With NSTask or system()?


On May 16, 2008, at 8:28 AM, JanakiRam wrote:

When i give this filename as part of rsync source file ( using -- 
files-from
) , rsync is treating this filename as 2 different file names ,  
because

rsync expects each filen name separated by \r.
Hence my rsync command is failing


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]