Are "Desktop", "Documents", etc. folders localized on filesystem level on Windows? - windows

An user of my program can select a new filename in "Documents" directory using "Save As" dialog (Python's tkinter.filedialog.asksaveasfilename), but they can't complete the operation, because system gives following error:
It looks like this problem has to do with French used as Windows language.
The user says that they can save into parent directory (ie. into home directory), but not under "Documents" and "Desktop".
Any ideas how this situation can occur and how to solve it?
On which level does the special folder localization happen? Is "Desktop" directory translated in filesystem?

Related

What is the path of "my computer" folder on windows?

I am working on a C++ windowsform project, using visual Studio IDE.
I use CFileDialog class to ask the user to select a file to open.
It display an usual open file selection windows.
I would like the default folder displayed to be the same as the one accessed when clicked on "My computer", where the harddrives, USB drives, dvd drives etc. are displayed.
I can define default folder by writting its path tolpstrInitialDir member, but I don't find the path for such a folder. I tried "\", "explorer.exe", "", none of them gave me the expected result.
The application will be used by several users, so the solution must not include the user name in the path. i.e "C:\Documents and Settings[user]\Desktop\My Computer" may work but is not correct for my application.
Does anyone know of to define the "root" path of windows (i.e the root of C:\) ?
I searched on SO and internet but maybe I have used wrong keywords because I couldn't find appropriate content.
My Computer is a virtual shell folder that doesn't correspond to any file system directory. There's no file system path that would correspond to that location.
Fortunately, file dialogs do speak "shellese", so you can use the CLSID (not to be confused with the GUID KNOWNFOLDERID or the CSIDL) of the shell folder. Sample in C# Winforms, but really, the only important part is the ::CLSID):
var ofd = new OpenFileDialog();
ofd.InitialDirectory = "::{20D04FE0-3AEA-1069-A2D8-08002B30309D}";
ofd.ShowDialog();
Disclaimer: I couldn't find any relevant documentation for the virtual folder CLSID, or this behaviour of the File dialog. So this is most likely not contractual, and could possibly change in future versions of Windows.
In the explorer, in the search bar copy the address of
This PC
and then select the text
This PC
and paste. Normally we get the
Ce PC ":: {CLSID}"
and then just copy
:: {CLSID}
and paste it wherever we want.
Path should be: C:\Users\UserName\Desktop\Computer.lnk

moving one folder to another folder - applescript

I'm trying to move a user-selected folder to another folder, but I don't get it: whenever I look it up, it looks too complicated, even though I know it's not supposed to be.
Here's the code I have so far - please help:
choose folder with prompt "Select folder:"
on open of finderObject
tell application "Finder" to move (finderObject) to folder "Library:Application Support"
end open
end
First off, you have to assign the chosen folder to a variable.
Also, many special folders in the OSX file structure have special names to get their paths, including the library and the application support folders. So, your script can simply be:
set finderObject to choose folder with prompt "Select folder:"
tell app "Finder" to move finderObject to folder (path to Application Support folder from local domain as string)
However, that is the root level Library folder. I suspect you will want to use the Application Support folder in the ~/ user domain. For that, change the "from local domain" to "from user domain".

How to customize a folder programatically on Windows 7

Windows 7 offers the possibility to customize folder icons and pictures by right clicking on the folder, choosing the "Properties" command and then the "Customize" tab, as explained for example here.
Can this be done programatically ?
Yes, you can create a desktop.ini file programmatically. The file is documented here.
You could, for instance, rename the folder in an internationalization scenario (e.g. a folder named "users" could me displayed to the user as utilisateurs on a French OS, or Benutzer on a German OS), by creating a file with the following contents:
[.ShellClassInfo]
LocalizedResourceName=#C:\foo\bar.dll,-100
which would take the name of the folder in the bar.dll string resource ID 100.

"Virtual Files" in OSX Finder that only appear when my Application runs, possible?

is there a way to "hook" into the OSX Finder to perform the following:
When my Application starts, the User sees a Folder in his Finder which is created by my application. Inside this Folder the User sees Files from several Folders...a unified view to several Files in several Folders that the User specified in my Application.
So, in this "Unified Folder" are not the real Files, they are still in there original Folder but the User sees them in this one Folder as if there were all his real Files in this new Folder. So there is no copying or moving involved.
To be honest, I've no Idea if it's possible and what I should looking for inside the Cocoa SDK. Maybe there is an API for the Finder itself or some other way?!
Regards
twickl
First option is your application could create aliases to the original files. The Finder will show these with a small arrow "badge" over the icon, so it is clear they are not the original files but aliases of them.
If you don't like the badges on the icons creating hard links may give you what you want.
Mac OS X presents a view of the HFS+ (Mac) filesystem which matches the UFS (Unix) one and you have access to hard and symbolic links. The latter are treated by the Finder similar to aliases but the former are indistinguishable from the original files as they are the original files - under the Unix filesystem a file in a directory is just a reference (the inode number) to the real file, each entry in a directory is just a hard link to the actual file, and a file can have any number of hard links to it (a file is deleted when the link count drops to 0, think of the retain/release model if that helps).
At the Cocoa level NSFileManager has methods to create hard links, or you can use the Unix level link(2) function.

Why is a duplicate folder being created in users/public/public documents on Windows 7?

A java application is using the %PUBLIC% environment variable to get the path to "c:\users\public". It then appends that with "public documents" and tries to read a file from the folder and fails (it previously read and wrote the file successfully). The application shows no data and when it tries to write to the "c:\users\public\public documents" folder a duplicate "c:\users\public\public documents" folder is created with the new version of the content. You can still get to the original content using windows explorer and see it all there, but now there are two "public documents" folders.
Previously it was reading and writing to the public documents folder without any problem. This is happening with every account on the system, but it is still working just fine on every other PC the software is installed on.
What Windows Explorer doesn't make evident is that the real folder is not actually called "Public Documents", but is actually called "Documents". The "Public Documents" is simply a display name, but as far as NTFS is concerned you can have both a "Documents" and "Public Documents" folder with no ill effects.
Use %PUBLIC%\Documents to refer to the actual folder you're looking for.

Resources