Closed Bug 122510 Opened 23 years ago Closed 21 years ago

Deprecate PR_GetDirectorySeparator()

Categories

(NSPR :: NSPR, defect)

x86
Mac System 9.x
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED WONTFIX

People

(Reporter: john, Assigned: wtc)

Details

The directory separator for Macintosh is a ':'. Yet when we define it in http://lxr.mozilla.org/seamonkey/source/nsprpub/pr/include/md/_macos.h, we define it as '/'. Form submission currently works around this with an ifdef (it uses ':' on Mac and PR_DIRECTORY_SEP on other platforms). Mac I/O code works because it does path translation from ':' to '/', but when it does this it uses PR_PATH_SEP for the ':' when that's not what it's being used for!
This is a valid proposal, but we can't make this incompatible change. Sorry. I suggest that you define your own directory separator macros that expand to the right characters.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
is it well documented that these two consts pairs are totally broken? if not please document it. Could nspr create an opt in (#ifdef NSPR_CORRECTMAC_SEP) to get the correct values for these constants? then seamonkey can do the right thing by opting in and others can be given a warning that their code is broken with an explanation of how to fix it.
NSPR is not exporting the PR_DIRECTORY_SEPARATOR macro. I suspect that the form submitter code is getting the definition of PR_DIRECTORY_SEPARATOR from xp_path.h. I added the PR_DIRECTORY_SEPARATOR macro definition to xp_path.h when I found that Mozilla Classic was including NSPR's private header files to get the definition of PR_DIRECTORY_SEPARATOR, and that macro and other similar macros were used in many Mozilla Classic files. In hindsight it was the wrong thing to do but it seemed like an expedient solution at that time. I just did an LXR search for PR_DIRECTORY_SEPARATOR in the current Mozilla and found that there are only three files using this macro (one in OJI, two in form submitter). So I suggest that you do this: 1. Remove the PR_DIRECTORY_* and PR_PATH_* macros from xp_path.h. 2. Define your own directory and path separator macros. 3. Modify the OJI and form submittor files to use the new macros. timeless wrote: > is it well documented that these two consts pairs > are totally broken? if not please document it. As I explained above, NSPR does not export these macros. However, it does export the PR_GetDirectorySeparator() function, which also returns '/' on Mac. I found that this function is not documented. Since it returns inconsistent results (on Windows, it returns the native directory separator \, on Mac, it returns the NSPR directory separator /), perhaps this function should be deprecated and stay undocumented.
Deprecating PR_GetDirectorySeparator() sounds fine with me. Do you want to provide a replacement or should xpcom define its own (nsIFile could probably do that)?
Summary: Macintosh PR_DIRECTORY_SEP incorrect → Macintosh PR_DIRECTORY_SEP and PR_GetDirectorySeparator() are incorrect
I would rather see these on a system info interface.
.
Status: RESOLVED → REOPENED
Resolution: WONTFIX → ---
Summary: Macintosh PR_DIRECTORY_SEP and PR_GetDirectorySeparator() are incorrect → Deprecate PR_GetDirectorySeparator()
please deprecate this for the next release
Assignee: timeless → wtc
Status: REOPENED → NEW
Form submission is no longer using directory separator foo, BTW (it's parsing using the standard file parser).
Whatever replaces PR_GetDirectorySeparator should replace PR_GetPathSeparator as well.
cls, I don't understand your comment. PR_GetPathSeparator does not have the problem of PR_GetDirectorySeparator that I described in the last paragraph of comment 3.
I was mainly just making a note about the new function so that the functionality isn't overlooked. IMO, the two functions go hand-in-hand. If you can get the directory separator from nsISystemInfo (or somewhere else outside of NSPR), you should be able to get the path separator from there as well. Btw, is there a bug on adding that functionality to nsISystemInfo or are we overloading this one?
Is this still needed on other platforms or can this be resolved because we removed mac classic from the cvs tree?
Right. Now that we don't support Mac Classic, we no longer need to deprecate PR_GetDirectorySeparator().
Status: NEW → RESOLVED
Closed: 23 years ago21 years ago
Resolution: --- → WONTFIX
verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.