mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 02:09:28 +00:00
Bug 1650013 - Strip unexpected leading slash from absolute path on Windows when loading hyphenation resource. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D81980
This commit is contained in:
parent
9c734f1175
commit
b9d874ff7d
@ -179,8 +179,18 @@ nsHyphenator::nsHyphenator(nsIURI* aURI, bool aHyphenateCapitalized)
|
||||
// remains zero; mDict is not a pointer to the raw data but an opaque
|
||||
// reference to a Rust object, and can only be freed by passing it to
|
||||
// mapped_hyph_free_dictionary().
|
||||
// (This case occurs in unpackaged developer builds.)
|
||||
nsAutoCString path;
|
||||
aURI->GetFilePath(path);
|
||||
#if XP_WIN
|
||||
// GetFilePath returns the path with an unexpected leading slash (like
|
||||
// "/c:/path/to/firefox/...") that may prevent it being found if it's an
|
||||
// absolute Windows path starting with a drive letter.
|
||||
// So check for this case and strip the slash.
|
||||
if (path.Length() > 2 && path[0] == '/' && path[2] == ':') {
|
||||
path.Cut(0, 1);
|
||||
}
|
||||
#endif
|
||||
UniquePtr<const HyphDic> dic(mapped_hyph_load_dictionary(path.get()));
|
||||
if (dic) {
|
||||
mDict = AsVariant(std::move(dic));
|
||||
|
Loading…
x
Reference in New Issue
Block a user