Closed
Bug 745466
Opened 13 years ago
Closed 13 years ago
initWithPath fails for "~"
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
FIXED
mozilla14
People
(Reporter: asaf, Assigned: asaf)
Details
Attachments
(1 file)
(deleted),
patch
|
bzbarsky
:
review+
benjamin
:
superreview+
|
Details | Diff | Splinter Review |
initWithPath("~/Downloads") - works.
initWithPath("~/Downloads/") - works.
initWithPath("~/") - works.
initWithPath("~") - does not work.
Assignee | ||
Comment 1•13 years ago
|
||
Assignee: nobody → mano
Status: NEW → ASSIGNED
Attachment #615066 -
Flags: superreview?(bzbarsky)
Attachment #615066 -
Flags: review?(bzbarsky)
Assignee | ||
Comment 2•13 years ago
|
||
This is necessary for bug 710259 (for importing the Downloads folder if it's set to the user's home folder).
Comment 3•13 years ago
|
||
Comment on attachment 615066 [details] [diff] [review]
patch + test
r=me, but this needs a separate sr
Attachment #615066 -
Flags: superreview?(bzbarsky)
Attachment #615066 -
Flags: superreview?(benjamin)
Attachment #615066 -
Flags: review?(bzbarsky)
Attachment #615066 -
Flags: review+
Assignee | ||
Comment 4•13 years ago
|
||
Comment on attachment 615066 [details] [diff] [review]
patch + test
Thanks Boris.
>- if (Substring(filePath, 0, 2).EqualsLiteral("~/")) {
>+ if (filePath.Equals("~") || Substring(filePath, 0, 2).EqualsLiteral("~/")) {
> nsCOMPtr<nsIFile> homeDir;
> nsCAutoString homePath;
> if (NS_FAILED(NS_GetSpecialDirectory(NS_OS_HOME_DIR,
> getter_AddRefs(homeDir))) ||
> NS_FAILED(homeDir->GetNativePath(homePath))) {
> return NS_ERROR_FAILURE;
> }
>-
>- mPath = homePath + Substring(filePath, 1, filePath.Length() - 1);
>+
>+ mPath = homePath;
>+ if (filePath.Length() > 1)
>+ mPath.Append(Substring(filePath, 1, filePath.Length() - 1));
> } else {
That shoukd have been > 2 (or could have been, it does not hurt as it is now).
Updated•13 years ago
|
Attachment #615066 -
Flags: superreview?(benjamin) → superreview+
Assignee | ||
Comment 5•13 years ago
|
||
Target Milestone: --- → mozilla14
Comment 6•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 7•13 years ago
|
||
and the follow-up
https://hg.mozilla.org/mozilla-central/rev/296b90f063d5
You need to log in
before you can comment on or make changes to this bug.
Description
•