[Wine]Navigating to the upper floor of the /Home directory using Wine.

Holly Bostick motub at planet.nl
Thu May 19 18:38:47 CDT 2005

Robert Yu schreef:
> So to translate this to M$ terms, it shall be the following:
> C:\---------
>             |
>             Macromedia Flash MX
>             Pics
>             Power Rangers Video game
> D:\--------
>            |
>            Home------------
>                                |
>                                 Motobut
> Is there a way to move up the C a and  D directories? And what is a
> symbolic link?

Robert, you've forgotten to use Reply to All again-- the idea of having
a mailing list is that both questions and replies should go to the list
so that others with the same problem can also find the answer.

Now, as to your question: Not exactly.

First of all, let's not "translate into M$ terms". They don't exist; the
 "drives" you are creating are a fiction to fool Windows-based programs.
You don't have a C:\ or a D:\ drive under Linux. You have partitions,
mounted to directories under the / filesystem.

Even if you have a FAT32 partition which is recognized as C:\ under
Windows, that is meaningless when you're booted into Linux; that same
partition is no longer considered C:\ (because Linux does not recognize
that naming convention), but /dev/hd*, mounted as
/home/username/windrive (or whatever) via /etc/fstab.

And it seems to me that thinking of that partition as C:\ is just
confusing you, so let's not do that anymore.

Let's talk about symbolic links instead. I think I explained this once
before. A symbolic link (usually known as a symlink) is a way to call a
path by a different name, and often make it shorter.

Let's say I have an important and often-used document-- my CV/resume--
in a folder somewhere on my drive. My resume/CV is called CV.txt, and
it's in the folder /home/holly/storage/docs/work. Thus, the full path to
the document is ~/storage/docs/work/CV.txt.

Now, if I open up a file manager in order to open up that file, I have
to go through 3 folders (since the file manager starts in my home folder
by default) in order to get to it. First (double-)click the "storage"
folder, then (double-)click the "docs" folder, then (double-)click the
"work" folder, then (double-)click the CV.txt file to open it. That gets
very tedious, very fast, if I use the file a lot.

However, what I can do is make a symlink in my home folder, directly to
the file. The symlink is not itself a file; it's just a pointer that
says where the file is. So if I symlink ~/storage/docs/work/CV.txt to
~/CV.txt, an icon (with a "shortcut" overlay) called CV.txt will appear
in my home folder. If I (double-)click it, ~/storage/docs/work/CV.txt
will open. The *link* in my home directory is a *symbol* representing
the real file much deeper in my directory tree. I can delete symlinks,
change their names, move them to another directory, all without
affecting the file they refer to, because they're only symbols, and
symbols only mean what we say they mean.

For Wine, the use of symlinks is slightly expanded. The symlinks in
~/.wine/dosdevices are still symbolic links to Linux drives or
partitions mounted under the / filesystem-- but for Wine, names are
important, because Windows only understands certain names, Windows
requires that certain specific names exist, and programs that run under
Windows expect these names to exist and for certain specificly-named
files to be in certain specifically-named places.

So if a program is looking for a particular standard system file, that
file *must be* in C:\Windows(or WINNT)\System(32), dependent on Windows
version, because Windows applications know that that's the only place
Windows places such files.

However, this Linux system does not have a C:\ drive, nor a Windows
folder. What it has is /usr, /home, etc. So Wine uses symlinks to
mediate between the filesystem that Windows applications expect, and the
Linux filesystem that actually exists. This is the purpose of the
/dosdevices directory. It contains the symlinks that tell Wine what
parts of the real Linux filesystem you want to use, and what you want
Wine to tell Windows they are called.

If you look in your ~/.wine/dosdevices directory, you will find at least
two symlinks. One called c: and one called z: . The c: symlink points to
~/.wine/drive_c (if you click it, that is the folder that will open in
your file manager). This folder and its contents are created by Wine on
firstrun, because, in order for Windows to run, a folder must be
designated as "C:\Windows", and that folder must be populated with
certain contents. Otherwise no Windows application will be fooled into
believing that it is being run under Windows. So Wine creates this
folder, populates it with the necessary contents, and creates the c:
symlink. That symlink must be named c: because the drive containing the
Windows system folders is always C:\ (this is in the Microsoft Knowledge
Base). The other symlink, z: , points to the / -- the Linux filesystem
root. This is so that you can get to the rest of your filesystem in a
Windows Open or Save dialog-- and it is named z: so that there is no
possibility of it conflicting with any other symlinks you may create.
The assumption is, then, clearly that you will create additional
symlinks to suit your particular needs.

So yes, you are free to create links using whatever drive letters are
not used by default. For example, a: would by default be your floppy
drive and b: would be a second floppy if you had one-- these are Windows
defaults, so it is best not to link anything to those letters. But d:
through y: are perfectly free for you to link to whatever you like. M:\
is the drive letter Windows usually gives removable devices like CD-ROMs
or DVDs, so I like to link m: to /mnt/cdrom (or /media/dvdrecorder, or
wherever my distribution mounts my DVD-RW). Linking /home/username to d:
makes it faster to browse through Open and Save dialogs if you save a
lot of stuff to your {HOME} since such dialogs usually open in C:\ by
default. I don't save that much in ~/, but I like to keep my Wine
applications all together, so they have their own partition, which I
link to d: and {HOME} to e: .

To make a symlink, open a terminal and type

ln -s <source_directory_or_file> <location_and_name_of_the_final_link>

So to make a symlink in dosdevices, to /home, called d:, you would type

ln -s /home/username /home/username/.wine/dosdevices/d:

(replace "username" with the name of the user in question) and hit Enter.

Now browse to ~/.wine/dosdevices in a file manager, and click on the new
d: link; you'll find yourself looking at your home directory. Then open
a Windows program --notepad.exe is a good one for this experiment; wine
notepad.exe in a terminal should bring it up.

In the blank document, type anything, then save it to the D:\ drive as
whatever.txt. Close notepad, open your file manager, and look for
whatever.txt-- there it is, in your /home folder.

That's how it works-- Windows programs now consider your /home folder to
be the D:\ drive, because that's what your symlink told Wine to tell the
Windows programs (that d: is a symbol representing ~/ to Linux and D:\
to Windows).

Hope this helps.

More information about the wine-users mailing list