Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages
Started by bar
Tue, 18 Mar 2008 17:27
Application directory
Author: bar
Date: Tue, 18 Mar 2008 17:27
Date: Tue, 18 Mar 2008 17:27
17 lines
1461 bytes
1461 bytes
Hi friends.
I want to create a directory that my application uses. Now i am creating the
directory in the Application Folder where the program is installed.
String InstallationPath = ExtractFilePath(Application->ExeName);
String CustomDirectory = InstallationPath + "\\data";
if(!DirectoryExists("Installation Path\\data"))
CreateDir(CustomDirectory);
1.How can i stop the user from Opening and Deleting this "data"folder.
2.Can i make the directory only for my application.
All help greatly appreciated.
Thanks
SA
Re: Application directory
Author: Remy Lebeau (TeamB)
Date: Tue, 18 Mar 2008 19:09
Date: Tue, 18 Mar 2008 19:09
37 lines
2554 bytes
2554 bytes
"bar" <shaikakbar250281@yahoo.co.in> wrote in message
news:47dffb86@newsgroups.borland.com...
> I want to create a directory that my application uses. Now
> i am creating the directory in the Application Folder where
> the program is installed.
Starting with XP onwards, that is not a good place to store your app's data
files anymore. You should now use SHGetSpecialFolderLocation() or related
function to retreive the CSIDL_LOCAL_APPDATA, CSIDL_COMMON_APPDATA, or
CSIDL_APPDATA folder location instead, depending on your needs. You can
then create subfolders underneath that as needed. The main reason for this
is because many of the common folders used in the past are now locked down
for security reasons and cannot (or should not) be written to anymore. Such
as any folders underneath the "Program Files" folder.
> if(!DirectoryExists("Installation Path\\data"))
> CreateDir(CustomDirectory);
Why are you dynamically building up a path variable but then still using a
hard-coded (and incorrect) string literal instead?
if(!DirectoryExists(CustomDirectory))
> 1.How can i stop the user from Opening and Deleting this "data"folder.
> 2.Can i make the directory only for my application.
The machine's admin would have to create a new user account that only your
app knows the credentials for. It can then log into that account
programmably and assign it as the owner of any folder that you create, and
be the only account with access rights to it. I do not recommend this
approach, though. Why are you trying to prevent the user from accessing
your app's files?
Gambit
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads