special-folders

Check if DirectoryInfo.FullName is special folder

允我心安 提交于 2019-12-06 11:54:47
My goal is to check, if DirectoryInfo.FullName is one of the special folders. Here is what I'm doing for this (Check directoryInfo.FullName to each special folder if they are equal): DirectoryInfo directoryInfo = new DirectoryInfo("Directory path"); if (directoryInfo.FullName == Environment.GetFolderPath(Environment.SpecialFolder.Windows) || directoryInfo.FullName == Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles ||) ... ... ) { // directoryInfo is the special folder } But there are many special folders (Cookies, ApplicationData, InternetCache, etc.). Is there any way to do

In Mono, how do I get the path to the Documents folder on a Mac (Snow Leopard)?

我的梦境 提交于 2019-12-05 22:20:47
I'm writing a Mono application and would like to find the full path of the Documents folder - e.g. /Users/johnsmith/Documents/ . What's the best way to achieve this? You can do this: string doc_path = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.Personal), "Documents"); (Btw, for MonoTouch, It's just Environment.GetFolderPath (Environment.SpecialFolder.Personal) ). 来源: https://stackoverflow.com/questions/1933975/in-mono-how-do-i-get-the-path-to-the-documents-folder-on-a-mac-snow-leopard

How to specify log file path using folder locations in Windows with log4net xml configurator?

我们两清 提交于 2019-12-05 00:29:51
In my app.config I put <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender"> <file value="%programdata%/log-file.txt"/> but it didn't work. Any ideas? The log4net syntax for expanding environment variables is "${Variable}" e.g. <file value="${LOCALAPPDATA}\GojiSoft\GojiLog\log.txt" /> Resurrecting an old thread here, but I encountered the same issue and thought I'd share. ${PROGRAMDATA}, as discussed in the comment thread of the other answer, didn't work for me (same as for OP). However, I saw a comment somewhere about it being case sensitive. Tried ${ProgramData}

Windows: How to canonicalize a file to the special folder?

五迷三道 提交于 2019-12-04 22:52:30
问题 i want to to persist some filenames for the user (e.g. recent files). Let's use six example files: c:\Documents & Settings\Ian\My Documents\Budget.xls c:\Documents & Settings\Ian\My Documents\My Pictures\Daughter's Winning Goal.jpg c:\Documents & Settings\Ian\Application Data\uTorrent c:\Documents & Settings\All Users\Application Data\Consonto\SpellcheckDictionary.dat c:\Develop\readme.txt c:\Program Files\Adobe\Reader\WhatsNew.txt i'm now hard-coding path to special folders. If the user

geting special folders with shell.application

≡放荡痞女 提交于 2019-12-04 20:48:34
I need in a script to return the path to the current user desktop. Now I know you can do it with WScript. var WshShell = WScript.CreateObject("WScript.Shell"); strDesktop = WshShell.SpecialFolders("Desktop"); But for my script this will not work as I cant use WScript. but I can use the shell.application object as below. dim objShell dim ssfWINDOWS dim objFolder ssfWINDOWS = 0 set objShell = CreateObject("shell.application") set objFolder = objshell.BrowseForFolder(0, "Example", 0, ssfWINDOWS) if (not objFolder is nothing) then Set objFolderItem = objFolder.Self g_objIE.Document.All("logdir")

Accessing %appdata% with VB.NET

北城余情 提交于 2019-12-03 15:29:41
问题 How can you access files in %appdata% through VB.NET? For example, C:\Users\Kuzon\AppData\Roaming\program . How would I access that file, but on another Windows 7 machine? Also, how would you do it on Windows XP? I believe it is %Application Data% . 回答1: When you're writing .NET code, it's recommended that you use the functions explicitly designed for this purpose, rather than relying on environment variables such as %appdata% . You're looking for the Environment.GetFolderPath method, which

Windows: How to canonicalize a file to the special folder?

别来无恙 提交于 2019-12-03 14:25:34
i want to to persist some filenames for the user (e.g. recent files). Let's use six example files: c:\Documents & Settings\Ian\My Documents\Budget.xls c:\Documents & Settings\Ian\My Documents\My Pictures\Daughter's Winning Goal.jpg c:\Documents & Settings\Ian\Application Data\uTorrent c:\Documents & Settings\All Users\Application Data\Consonto\SpellcheckDictionary.dat c:\Develop\readme.txt c:\Program Files\Adobe\Reader\WhatsNew.txt i'm now hard-coding path to special folders. If the user redirects their folders, roams to another computer, or upgrades their operating system, the paths will be

Finding a Windows user's “true” application data folder?

牧云@^-^@ 提交于 2019-12-03 11:53:06
I have a Delphi 6 application that, like most Windows applications, reads/writes data to the user's "local application data" folder. I use the code below to determine that folder. Up until now, that code worked for most of my users. I have encountered a user whose local application data is not in the expected folder: C:\Users\Bob\AppData\Roaming\ Usually the local app data folder resolves to: C:\Documents and Settings\Bob\Application Data\ What is odd about this user's particular situation is that several registry keys normally found in HKEY_LOCAL_MACHINE are actually located in HKEY_CURRENT

Set location of Special Folders with PowerShell

柔情痞子 提交于 2019-12-03 05:09:22
问题 As administrator, I want to change the default location of special folders (Documents, Music, Downloads…) to a different path. I can do this manually, but I would like to have a PowerShell script to do that. Is there any PS Object that provides functions to do this? How can I do it? Thanks. 回答1: PowerShell doesn't have a cmdlet that lets you do it out of the box (as far as I know), but you can use P/Invoke to call the SHSetKnownFolderPath shell function. I created a wrapper function called

Accessing %appdata% with VB.NET

本秂侑毒 提交于 2019-12-03 05:03:29
How can you access files in %appdata% through VB.NET? For example, C:\Users\Kuzon\AppData\Roaming\program . How would I access that file, but on another Windows 7 machine? Also, how would you do it on Windows XP? I believe it is %Application Data% . When you're writing .NET code, it's recommended that you use the functions explicitly designed for this purpose, rather than relying on environment variables such as %appdata% . You're looking for the Environment.GetFolderPath method , which returns the path to the special folder that you specify from the Environment.SpecialFolder enumeration . The