Closed
Bug 120467
Opened 23 years ago
Closed 15 years ago
file names on command lines don't work
Categories
(Core Graveyard :: Cmd-line Features, enhancement)
Tracking
(Not tracked)
RESOLVED
WORKSFORME
People
(Reporter: inform, Unassigned)
References
Details
Attachments
(1 file, 1 obsolete file)
1.97 KB,
patch
|
dougt
:
review-
|
Details | Diff | Splinter Review |
calling "mozilla <some local file name>" from the command line should display the file instead of trying to resolve host names like "index.html".
Comment 1•23 years ago
|
||
you and I know that index.html is a local file and that www.mozilla.org is a website, but Mozilla is going to have a lot more difficulty distinguishing between them. perhaps "if DNS fails on apparent hostname, try local file" would work better. please change severity to "enhancement"
Reporter | ||
Comment 2•23 years ago
|
||
i think the order should be "try file, then dns". open() is way faster than any (failing) dns lookup.
Severity: normal → enhancement
Comment 3•23 years ago
|
||
how about command-line-arguments starting with "." or "/" are local filenames? Any filename can be easily represented starting with one of those (./index.html) and no protocol or hostname can start with them. The default behavior is still an open issue, but doing the "." and "/" will not lose any of the current functionality.
Comment 4•23 years ago
|
||
ok, here's where it gets interesting. if you already have mozilla running and try this, it works (it opens a new window in the already-running process with the file). with, or without the leading "/", "\" or ".". If you give it a URL, it also works.
Comment 5•23 years ago
|
||
handling arguments beginning with "/" (or "\") as a file seems to be already implemented. This helps out a lot because you can use tab completion on the directories or (if you're in a nasty path) do: mozilla `pwd`/index.html
Comment 6•23 years ago
|
||
->cmd line component
Assignee: asa → law
Component: Browser-General → XP Apps: Cmd-line Features
QA Contact: doronr → sairuh
Comment 7•23 years ago
|
||
This should work the same on Windows, too. It does work if you specify the full path to the file, but in no other situation. OS => All
Comment 8•23 years ago
|
||
This seems to be a legitimate RFE at least (if not a bug that it doesn't currently work) and I can't see a DUPE of it so I am confirming it,
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 10•23 years ago
|
||
if the url starts with "." (./index.html), replace "." with $PWD, making $PWD/index.html
Comment 11•23 years ago
|
||
the patch sticks to changing what is obviously a file. "../" doesn't work because Mozilla doesn't understand it, so it would need to be handled explicitly. I think the patch should work on Windows as well, but I can't really test it.
Comment 12•23 years ago
|
||
Comment on attachment 79391 [details] [diff] [review] patch to handle ./index.html strcat does not return a new chunk of memory, so it will step on GetEnv's memory (freeing it is bad too)!
Attachment #79391 -
Flags: needs-work+
Comment 13•23 years ago
|
||
2nd try. a bit more complex as it PR_Mallocs its own memory.
Attachment #79391 -
Attachment is obsolete: true
Comment 14•22 years ago
|
||
*** Bug 157990 has been marked as a duplicate of this bug. ***
Comment 15•22 years ago
|
||
Galeon (1.2.7) does as expected (I guess it looks for filename first, then URL). Links (0.3) does as expected. I know these are unix only but still mozilla should have the same functionality IMHO.
Updated•21 years ago
|
Attachment #79576 -
Flags: review?(dougt)
Comment 16•21 years ago
|
||
Comment on attachment 79576 [details] [diff] [review] patch v2 to handle ./index.html + char *pwd = PR_GetEnv("PWD"); I doubt that is portable or even well supported. You should, if possible, use the directory service to get the pwd/cwd. nsCOMPtr<nsILocalFile> file(do_CreateInstance("@mozilla.org/file/local;1")); if (file) { - rv = file->InitWithPath(str); You probably should just use NS_NewNativeLocalFile() I think the module owner of this stuff should review this code.
Attachment #79576 -
Flags: review?(dougt) → review-
Comment 18•21 years ago
|
||
*** Bug 222222 has been marked as a duplicate of this bug. ***
Updated•18 years ago
|
Assignee: law → nobody
QA Contact: bugzilla
Target Milestone: Future → ---
Comment 19•15 years ago
|
||
We now resolve commandline args relative to the current working directory, which normally works. Firefox also supports -file /path
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•