Closed Bug 120467 Opened 24 years ago Closed 17 years ago

file names on command lines don't work

Categories

(Core Graveyard :: Cmd-line Features, enhancement)

x86
Linux
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: inform, Unassigned)

References

Details

Attachments

(1 file, 1 obsolete file)

calling "mozilla <some local file name>" from the command line should display the file instead of trying to resolve host names like "index.html".
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"
i think the order should be "try file, then dns". open() is way faster than any (failing) dns lookup.
Severity: normal → enhancement
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.
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.
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
->cmd line component
Assignee: asa → law
Component: Browser-General → XP Apps: Cmd-line Features
QA Contact: doronr → sairuh
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
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 4 seems to be specific to RPM and x-remote
Attached patch patch to handle ./index.html (obsolete) — Splinter Review
if the url starts with "." (./index.html), replace "." with $PWD, making $PWD/index.html
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.
Keywords: patch, review
Target Milestone: --- → mozilla1.1alpha
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+
Keywords: review
2nd try. a bit more complex as it PR_Mallocs its own memory.
Attachment #79391 - Attachment is obsolete: true
*** Bug 157990 has been marked as a duplicate of this bug. ***
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.
Attachment #79576 - Flags: review?(dougt)
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-
retargeting
Target Milestone: mozilla1.1alpha → Future
*** Bug 222222 has been marked as a duplicate of this bug. ***
Assignee: law → nobody
QA Contact: bugzilla
Target Milestone: Future → ---
We now resolve commandline args relative to the current working directory, which normally works. Firefox also supports -file /path
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → WORKSFORME
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: