Closed Bug 465783 Opened 16 years ago Closed 16 years ago

Fennec default download location inaccessible to users

Categories

(Firefox for Android Graveyard :: General, defect)

Other
Linux
defect
Not set
normal

Tracking

(fennec1.0b1+)

VERIFIED FIXED
Tracking Status
fennec 1.0b1+ ---

People

(Reporter: cmtalbert, Assigned: tonikitoo)

Details

(Whiteboard: [good first bug])

Attachments

(1 file, 3 obsolete files)

The default location for downloads in fennec is /home/user/Downloads however the user only has access to the file system inside /home/user/MyDocs/ (from the file manager in the phone) == expected == The user should be able to find downloaded files using the file manager
Flags: blocking-fennec1.0?
tracking-fennec: --- → 1.0b1+
Flags: blocking-fennec1.0?
We need to establish where we want to default to on Maemo and Win Mobile. I guess /home/user/MyDocs is the maemo location. Is that a "special" folder for Maemo or will we need to expicitly set that using the download preferences? Use preprocessing defines in mobile.js to keep Maemo and WinMo separate.
Whiteboard: [good first bug]
We could also just fix the directory service and/or nsDownloadManager::GetDefaultDownloadsDirectory to return the right directories for those platforms.
(In reply to comment #2) > We could also just fix the directory service and/or > nsDownloadManager::GetDefaultDownloadsDirectory to return the right directories > for those platforms. I like that idea the best
(In reply to comment #2) > We could also just fix the directory service and/or > nsDownloadManager::GetDefaultDownloadsDirectory to return the right directories > for those platforms. Fixing the directory service should basically fix nsDownloadManager
Assignee: nobody → mkristoffersen
this is what is happening: * in nsDownloadManager::GetDefaultDownloadsDirectory method body there is (...) #elif defined(XP_UNIX) rv = dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(downloadDir)); // fallback to Home/Downloads if (NS_FAILED(rv)) { rv = dirService->Get(NS_UNIX_HOME_DIR, NS_GET_IID(nsILocalFile), getter_AddRefs(downloadDir)); NS_ENSURE_SUCCESS(rv, rv); rv = downloadDir->Append(folderName); NS_ENSURE_SUCCESS(rv, rv); } (...) fennec (maemo) goes to the fallback implementation because "dirService->Get(NS_UNIX_DEFAULT_DOWNLOAD_DIR," fails: basically maemo has no "xdg-user-dirs" data/info available (see ~/.config/user-dirs.dirs in your linux desktop to know what I am talking about) and so the fallback code comes in scene. In fallback implementation, "$(HOME)/Downloads" turns to be the default folder for downloads (see http://mxr.mozilla.org/mozilla-central/source/toolkit/locales/en-US/chrome/mozapps/downloads/downloads.properties#120 ) the simpler approach would be to make the fallback use "MyDocs" instead of "Downloads" for maemo. taking ...
Assignee: mkristoffersen → tonikitoo
Status: NEW → ASSIGNED
Attached patch v0.1 - simpler appoach (obsolete) — Splinter Review
patch basically makes the fallback implementation to end up in /home/user/MyDocs folder in maemo.
Attachment #362531 - Flags: review?
Comment on attachment 362531 [details] [diff] [review] v0.1 - simpler appoach Can we just get the users doc directory with the directory service instead please?
Attachment #362531 - Flags: review? → review-
I think the directory service _and_ download manager will need patches. Maemo does not have a "download" directory. It does have a "documents" directory, much like WindowsXP. I think we should add code to directory service so suppport NS_UNIX_XDG_DOCUMENTS_DIR (which might already work, I haven't tested it): http://mxr.mozilla.org/mozilla-central/source/xpcom/io/nsDirectoryService.cpp#1179 We should also add code to the download manager to use the "documents" folder as a fallback, like we do for Windows, except we should not create/append the "Downloads" folder.
> I think we should add code to directory service so suppport > NS_UNIX_XDG_DOCUMENTS_DIR (which might already work, I haven't tested it): All UNIX_XDG_BLABLA falls in the same treatment: (...) case Unix_XDG_Desktop: case Unix_XDG_Documents: case Unix_XDG_Download: case Unix_XDG_Music: case Unix_XDG_Pictures: case Unix_XDG_PublicShare: case Unix_XDG_Templates: case Unix_XDG_Videos: return GetUnixXDGUserDirectory(aSystemSystemDirectory, aFile); (...) however in "GetUnixXDGUserDirectory" ~/.config/user-dirs.dirs is needed otherwise it goes to a fallback (maemo case). So we can handle 'Unix_XDG_Documents' in that fallback for maemo.
mark, shawn, what about this? (see comment 9 above)
Attachment #362531 - Attachment is obsolete: true
Attachment #362632 - Flags: review?
Attachment #362632 - Attachment description: v0.2 - make DirService to support by making use of Unix_XDG_Documents, calling it from nsDownloadManager → v0.2 - make DirService to support Unix_XDG_Documents for maemo, and calling it from nsDownloadManager also for that platform
basically instead of /home/user/MyDocs default location is /home/user/MyDocs/.documents , as per mark's suggestion on irc.
Attachment #362632 - Attachment is obsolete: true
Attachment #362646 - Flags: review?
Attachment #362632 - Flags: review?
Comment on attachment 362646 [details] [diff] [review] v0.3 - make GetUnixXDGUserDirectory @ SpecialSystemDirectories to fallback in "$MYDOCSDIR/.documents" for Unix_XDG_Documents. From a Fennec point of view, I'm OK with the way this works.
Attachment #362646 - Flags: review?(sdwilsh)
Attachment #362646 - Flags: review?
Attachment #362646 - Flags: review+
Attachment #362646 - Flags: superreview?(benjamin)
Attachment #362646 - Flags: review?(sdwilsh)
Attachment #362646 - Flags: review+
Comment on attachment 362646 [details] [diff] [review] v0.3 - make GetUnixXDGUserDirectory @ SpecialSystemDirectories to fallback in "$MYDOCSDIR/.documents" for Unix_XDG_Documents. >+#if defined(NS_OSSO) >+ rv = dirService->Get(NS_UNIX_XDG_DOCUMENTS_DIR, >+ NS_GET_IID(nsILocalFile), >+ getter_AddRefs(downloadDir)); >+#else nit: fix the indenting here (two spaces too many), and add a comment explaining why we do this. >diff -r 04ab0748f650 xpcom/io/SpecialSystemDirectory.cpp you'll need sr for this from bsmedberg
same patch as previous but added comment as requested. carrying mfinkle and sdwilsh r+ and reasking for sr=benjamin for the xpcom part.
Attachment #362646 - Attachment is obsolete: true
Attachment #363050 - Flags: superreview?
Attachment #363050 - Flags: review+
Attachment #362646 - Flags: superreview?(benjamin)
Attachment #363050 - Flags: superreview? → superreview?(benjamin)
Comment on attachment 363050 [details] [diff] [review] v0.4 - make GetUnixXDGUserDirectory @ SpecialSystemDirectories to fallback in "$MYDOCSDIR/.documents" for Unix_XDG_Documents. Boy, hardcoding ".documents" feels hacky, but if that's the official way of doing things...
Attachment #363050 - Flags: superreview?(benjamin) → superreview+
Summary: Default download location inaccessible to users → Fennec default download location inaccessible to users
fixed 1b3948b3562c581ddbb525d427721b3bce7c9682
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
I tried this today on the maemo device with the beta1 rc1 build, and it downloads to /home/user/MyDocs/.documents. When I use the maemo device, I cannot access .documents from a file input tag when using the "browse" button: https://developer.mozilla.org/samples/installjar.html It could be we need to fix the file tag to work like other applications, but this is still confusing.
Verified with 20091001 1.9.2 beta4 candidate on my n810
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: