Comments (13)
Hi @lambda, thanks for the report – I assumed that the adaption to the locale was happening at the UI level. Do you have further information on this?
from dirs-rs.
I can report a similar problem that we currently wrote code to work around dirs
when on macOS/iOS, would be something we can possibly PR for dirs-sys
which uses the native ObjC APIs as lambda mentioned above. This likely can fix:
- Locale issue like lambda's
- Sandboxing issues, if you're using dirs within a macOS app that's sandboxed or an iOS app which are always sandboxed, you might hit issues like I think I recall we did when running on iOS, home is different and not based on the user.
from dirs-rs.
Ok, weird. I had assumed that the folder names were translated in the UI layer for user-firendliness, but were not locale-dependent.
from dirs-rs.
I think it might depend on what locale the system was installed via? but don't quote me on that. As I can safely change my locale while those paths remain the same.
from dirs-rs.
So what happens to NSSearchPathForDirectoriesInDomains
when to locale is changed?
(Is there some config file that stores the paths with which the account was created?)
from dirs-rs.
I'd have to test, but my understanding is the paths are fixed upon user creation, so if locale is changed later it won't change the paths. But NSSearchPathForDirectoriesInDomains
will always return the appropriate path that leads to the user's/system's various folders as they currently exist on the drive.
I can do some testing and maybe work on a PR sometime, the big issue for us is ensuring sandboxing doesn't break dirs
as we tend to at least use some rust code on iOS as well.
from dirs-rs.
@jfro Would appreciate that! Is there some sys crate for calling NSSearchPathForDirectoriesInDomains
?
from dirs-rs.
I'd have to check if it's in any of the foundation crates... our work around we made uses the objc
crate to call NSFileManager
in Objective-C land which is the slightly higher level version. Forget if there's a reason to use one over the other, both deal with Objective-C classes. objc
has some macros that smoothed that over so I could get a C string out of it all.
from dirs-rs.
I started on it, first step was the sys crate: dirs-dev/dirs-sys-rs#6
Thinking can do a PR on this crate once there's a version of dirs-sys
to point it at with these changes
from dirs-rs.
I should probably mention that I haven't confirmed what I wrote in the original message; this was not based on a problem I've observed, but my (possibly mistaken) understanding of why there's an API call to retrieve these values, and noticing that they were hardcoded instead of calling that API.
So please make sure to confirm that this problem is real! I hope I don't cause people to do extra work for nothing.
from dirs-rs.
@lambda I'm unable to confirm the locale problem but the sandbox one is real as that has hit me, but that's more of a sandbox homedir vs regular homedir situation.
I can ask a co-worker that might be able to check, think there's at least 2 that likely have their systems in non-english from install/purchase.
from dirs-rs.
According to Apple documentation, "display names" are purely a display layer concern:
Display names do not affect the actual name of the file in the file system. Code that accesses a file or directory programmatically must specify the item’s actual name when opening or manipulating the item using the file system interfaces.
from dirs-rs.
I'd tend to close this, and if something comes out of the sandboxing issue, create a new issue for that. What do you think?
from dirs-rs.
Related Issues (20)
- New major release? HOT 3
- Fail to build on MacOS HOT 4
- does not work with rustc 1.13 as documented HOT 3
- XDG_BIN_HOME isn’t a standard HOT 9
- template_dir() for MacOS HOT 2
- sudo and $HOME HOT 19
- gcc error while testing
- Remove cfg-if HOT 2
- Windows: Add fallback for nanoserver Windows containers HOT 2
- MacOS $XDG_* HOT 1
- Add support for `XDG_STATE_HOME` HOT 1
- Windows font_dir HOT 6
- Thoughts on testing `dirs::config_dir()` on Windows? HOT 1
- Incorrect `config_dir` on Windows 10 HOT 3
- Systemd Service Directories HOT 2
- Add better descriptions as to what causes None to be returned. HOT 9
- Prefer $HOME (and XDG environment) even on Windows HOT 10
- Better Integration for Testing HOT 3
- use XDG_STATE_HOME as data_local_dir HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dirs-rs.