appdata

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

How do I reference the Sqlite db file in the App_Data folder for my ASP.NET Web Application?

别来无恙 提交于 2019-12-03 12:34:35
问题 I'm currently storing my sqlite db file in the App_Data folder as per ASP.NET best pattern and practices. Currently I'm using the following in the webconfig: <connectionStrings> <add name="sqlite" connectionString="Data Source=|DataDirectory|MyDB; Version=3;" /> </connectionStrings> and the following in code: public SqliteDAO(string path) { Connection = new System.Data.SQLite.SQLiteConnection(path ); } //... //where path = |DataDirectory|MyDB It causes sqlite to make a NEW database (with no

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

How can I get the path to the %APPDATA% directory in Python?

大兔子大兔子 提交于 2019-12-03 06:28:40
问题 How can I get the path to the %APPDATA% directory in Python? 回答1: import os print os.getenv('APPDATA') 回答2: You may use os.path.expandvars(path): Return the argument with environment variables expanded. Substrings of the form $name or ${name} are replaced by the value of environment variable name. Malformed variable names and references to non-existing variables are left unchanged. On Windows, %name% expansions are supported in addition to $name and ${name} . This comes handy when combining

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

How to get the application specific data folder (ProgramData)?

半世苍凉 提交于 2019-12-01 15:21:48
问题 I need to read and write files that contain application specific data, shared between all the users. I tried to use Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) , but it returns only C:\ProgramData . My question is : Does it exist a system like Path.GetDirectoryName(Application.UserAppDataPath) , which will give me the exact folder to write, according to my application name and version? Or is ProgramData not the right place to do that. Thanks. 回答1: Does it exist

How to run a jar file from another jar

北城以北 提交于 2019-12-01 13:38:43
I have a jar file that has been turned into a .exe using L4J, and another jar file in appdata. The reason for having two files is that I need an updating mechanism. My question: How do I run the .exe file on the desktop, then load the jar in appdata from it? You could use a URLClassLoader to load the second Jar at runtime. Depending on your needs, you may need a bridging interface (one that exists in both Jars) that you would call from your 'exe' to get the second Jar running...or you could simply use the second Jar's main method ;) The other choice you have is to run another JVM. UPDATE In

How to run a jar file from another jar

旧城冷巷雨未停 提交于 2019-12-01 10:11:30
问题 I have a jar file that has been turned into a .exe using L4J, and another jar file in appdata. The reason for having two files is that I need an updating mechanism. My question: How do I run the .exe file on the desktop, then load the jar in appdata from it? 回答1: You could use a URLClassLoader to load the second Jar at runtime. Depending on your needs, you may need a bridging interface (one that exists in both Jars) that you would call from your 'exe' to get the second Jar running...or you

When should I opt for IsolatedStorage versus AppData file storage?

感情迁移 提交于 2019-12-01 06:01:21
I've recently discovered the IsolatedStorage facilities in .net, and I'm wondering when I should use them for my application data versus when I should use (e.g.) Application.LocalUserAppDataPath . One thing that I've noticed is that Application doesn't exist outside of a winforms app, so it seems that IsolatedStorage might make sense for a class library that needs some specific storage, especially if that library might be used by both a web app and a winforms app. Is that the only distinguishing point, or is there more to it? (As a rule, up 'til now, I've made the app provide a file stream to

How to write to the common Application Data folder?

笑着哭i 提交于 2019-12-01 05:04:09
问题 I have a Visual Basic 6.0 application that I want to install for All Users , for example, the setting are held in a single spot regardless who logs into the computer. I have the following code to locate the common location: Const ssfCOMMONAPPDATA = &H23 Dim strAllUsersPath As String strAllUsersPath = CreateObject("Shell.Application").NameSpace(ssfCOMMONAPPDATA).Self.Path On Windows XP, this path points to C:\Documents and Settings\All Users\Application Data\ folder. The setup copies the