Need API to detect a Mac OS 9/X package

VERIFIED FIXED

Status

VERIFIED FIXED
17 years ago
2 years ago

People

(Reporter: mozilla, Assigned: mozilla)

Tracking

Trunk
PowerPC
Mac System 9.x

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Assignee)

Description

17 years ago
 
(Assignee)

Updated

17 years ago
Status: NEW → ASSIGNED
(Assignee)

Comment 1

17 years ago
Created attachment 67068 [details] [diff] [review]
IsPackage() method
(Assignee)

Comment 2

17 years ago
This patch adds a IsPackage() method onto nsILocalFileMac

Conrad, care to review?
Comment on attachment 67068 [details] [diff] [review]
IsPackage() method

>+NS_IMETHODIMP  
>+nsLocalFile::IsPackage(PRBool *outIsPackage)
>+{
>+    NS_ENSURE_ARG(outIsPackage);
>+    *outIsPackage = PR_FALSE;
>+
>+    PRBool isDir;
>+    nsresult rv = IsDirectory(&isDir); // Calls ResolveAndStat()
>+    if (NS_FAILED(rv)) return rv;

Since IsDirectory() also calls UpdateCachedCatInfo(), I'd change the comment to
say that and not make another call to UpdateCachedCatInfo(TRUE). Unless you
really want to pass TRUE and force an update of the cached info.

>+    
>+    rv = UpdateCachedCatInfo(PR_TRUE);
>+    if (NS_FAILED(rv)) return rv;
>+

>+            const char *extPtr = strrchr(name, '.');
>+            if (extPtr)
>+            {
>+                if (!nsCRT::strcasecmp(extPtr, ".app"))

There's also .framework and .bundle. Do we want to consider those as well?
Probably.

>+                {
>+                    *outIsPackage = PR_TRUE;
>+                }
>+            }
>+        }
>+    }
>+
>+    return NS_OK;
>+}
>+

Other than those points, which are debatable, looks good.

Comment 4

17 years ago
How do you intend to support BSD utils like bzip2/gzip in X ?
Keywords: qawanted
QA Contact: sairuh → nobody
(Assignee)

Comment 5

17 years ago
> Since IsDirectory() also calls UpdateCachedCatInfo(), I'd change the comment
> to say that and not make another call to UpdateCachedCatInfo(TRUE).

OK.


> There's also .framework and .bundle. Do we want to consider those as well?

I think the answer is "no", after observing how the Finder treats folders with
those extensions (it doesn't consider them to be a single item).
(Assignee)

Comment 6

17 years ago
Created attachment 67125 [details] [diff] [review]
Patch which just uses IsDirectory()

Patch incorporating Conrad's feedback [just use IsDirectory()]
Attachment #67068 - Attachment is obsolete: true
Comment on attachment 67125 [details] [diff] [review]
Patch which just uses IsDirectory()

Yeah, if the Finder only treats .app differently and treats .bundle as a
directory, that's the way to go.
r=ccarlen.
Attachment #67125 - Flags: review+
Comment on attachment 67125 [details] [diff] [review]
Patch which just uses IsDirectory()

sr=ben@netscape.com
Attachment #67125 - Flags: superreview+
(Assignee)

Comment 9

17 years ago
Fixed.
Status: ASSIGNED → RESOLVED
Last Resolved: 17 years ago
Resolution: --- → FIXED

Comment 10

16 years ago
Verified..
Status: RESOLVED → VERIFIED
Keywords: qawanted
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.