Closed Bug 367608 Opened 18 years ago Closed 18 years ago

implement nsIFile::normalize() on OS X

Categories

(Core :: XPCOM, enhancement)

1.8 Branch
x86
macOS
enhancement
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: sayrer, Assigned: sayrer)

References

Details

Attachments

(1 file, 2 obsolete files)

Attached patch implement normalize (obsolete) (deleted) — Splinter Review
Attachment #252175 - Flags: review?(mano)
Blocks: 364043
Assignee: sayrer → nobody
Component: File Handling → XPCOM
QA Contact: ian → xpcom
Assignee: nobody → sayrer
No longer blocks: 364043
Comment on attachment 252175 [details] [diff] [review] implement normalize >Index: nsLocalFileOSX.cpp >=================================================================== >+ PRBool success; >+ success = ::CFURLGetFileSystemRepresentation(mBaseRef, true, path, PATH_MAX); nit: use BOOL here. >+ if (!success) >+ return NS_ERROR_FAILURE; >+ >+ char resolved_path[PATH_MAX] = ""; >+ char *resolved_path_ptr = nsnull; >+ resolved_path_ptr = realpath((char*)path, resolved_path); >+ >+ // if there is an error, the return is null. >+ if (!resolved_path_ptr) >+ return NS_ERROR_FAILURE; >+ >+ // Need to know whether we're a directory to create a new CFURLRef >+ PRBool isDirectory; >+ nsresult rv = IsDirectory(&isDirectory); >+ if (NS_FAILED(rv)) >+ return rv; >+ nit: use NS_ENSURE_SUCCESS. r=mano otherwise.
Attachment #252175 - Flags: review?(mano) → review+
Attached patch address mano's comments, add tests (obsolete) (deleted) — Splinter Review
re: nit 1, I used Boolean, not BOOL. I also changed the result code if realpath fails, to emulate the unix version.
Attachment #252175 - Attachment is obsolete: true
Attachment #252635 - Flags: superreview?(benjamin)
Attachment #252632 - Attachment is obsolete: true
Attachment #252635 - Flags: superreview?(benjamin) → superreview+
Checking in io/nsLocalFileOSX.cpp; /cvsroot/mozilla/xpcom/io/nsLocalFileOSX.cpp,v <-- nsLocalFileOSX.cpp new revision: 1.48; previous revision: 1.47 done Checking in tests/nsIFileTest.cpp; /cvsroot/mozilla/xpcom/tests/nsIFileTest.cpp,v <-- nsIFileTest.cpp new revision: 1.32; previous revision: 1.31 done
Status: NEW → RESOLVED
Closed: 18 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Depends on: 349094
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: