file names on command lines don't work

RESOLVED WORKSFORME

Status

Core Graveyard
Cmd-line Features
--
enhancement
RESOLVED WORKSFORME
17 years ago
9 years ago

People

(Reporter: Andreas Kloeckner, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment, 1 obsolete attachment)

(Reporter)

Description

17 years ago
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

17 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

17 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

17 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

17 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

17 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

16 years ago
->cmd line component
Assignee: asa → law
Component: Browser-General → XP Apps: Cmd-line Features
QA Contact: doronr → sairuh

Comment 7

16 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

16 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 9

16 years ago
comment 4 seems to be specific to RPM and x-remote

Comment 10

16 years ago
Created attachment 79391 [details] [diff] [review]
patch to handle ./index.html

if the url starts with "." (./index.html), replace "." with $PWD, making
$PWD/index.html

Comment 11

16 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.
Keywords: patch, review
Target Milestone: --- → mozilla1.1alpha

Comment 12

16 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+

Updated

16 years ago
Keywords: review

Comment 13

16 years ago
Created attachment 79576 [details] [diff] [review]
patch v2 to handle ./index.html

2nd try.  a bit more complex as it PR_Mallocs its own memory.
Attachment #79391 - Attachment is obsolete: true

Comment 14

16 years ago
*** Bug 157990 has been marked as a duplicate of this bug. ***

Comment 15

16 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.
Attachment #79576 - Flags: review?(dougt)

Comment 16

15 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 17

15 years ago
retargeting
Target Milestone: mozilla1.1alpha → Future
*** Bug 222222 has been marked as a duplicate of this bug. ***

Updated

12 years ago
Assignee: law → nobody
QA Contact: bugzilla
Target Milestone: Future → ---

Comment 19

9 years ago
We now resolve commandline args relative to the current working directory, which normally works. Firefox also supports -file /path
Status: NEW → RESOLVED
Last Resolved: 9 years ago
Resolution: --- → WORKSFORME

Updated

9 years ago
Component: Cmd-line Features → Cmd-line Features
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.