How to determine if file is within the prefix/bottle or not?

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
wolbrink
Level 1
Level 1
Posts: 6
Joined: Wed Jun 02, 2010 7:59 pm

How to determine if file is within the prefix/bottle or not?

Post by wolbrink »

I'd like to put a warning into my application that warns the user if they try to store their document inside the prefix/bottle. (In other words I want to help the user avoid putting user data under the "drive_c" folder.)

I know that some folders are redirects, such as C:\Users\{user}\Desktop refers to the Desktop folder in the user's real profile, so this is safe, as well as many other special locations.

Is there a command-line tool my app can call (running within Wine) that will convert any given path to the native path outside of Wine?
jorl17
Level 5
Level 5
Posts: 365
Joined: Mon Jul 28, 2008 6:44 pm

Re: How to determine if file is within the prefix/bottle or

Post by jorl17 »

wolbrink wrote:I'd like to put a warning into my application that warns the user if they try to store their document inside the prefix/bottle. (In other words I want to help the user avoid putting user data under the "drive_c" folder.)

I know that some folders are redirects, such as C:\Users\{user}\Desktop refers to the Desktop folder in the user's real profile, so this is safe, as well as many other special locations.

Is there a command-line tool my app can call (running within Wine) that will convert any given path to the native path outside of Wine?
Well, there's winepath (http://wiki.winehq.org/winepath ; don't forget that readlink is always there too).

Additionally, there *is* an internal wine function named http://wiki.winehq.org/winepath as you can see, it lies in kernel32, so it should be adressable...
(http://source.winehq.org/WineAPI/kernel32.html)

Cheers,

Jorl17
jorl17
Level 5
Level 5
Posts: 365
Joined: Mon Jul 28, 2008 6:44 pm

Post by jorl17 »

I was obviously talking about wine_get_unix_file_name(), but my stupidity ruled over my ability to hit CTRL+C...

Cheers,

Jorl17
wolbrink
Level 1
Level 1
Posts: 6
Joined: Wed Jun 02, 2010 7:59 pm

Post by wolbrink »

jorl17 wrote:I was obviously talking about wine_get_unix_file_name()
Thanks for clarifying! I'll check into that. It sounds right! :) It'll be interesting to read the source code for that function, too.

--Troy
Locked