🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #498

Re: Application directory

#498
From: Remy Lebeau (TeamB)
Date: Tue, 18 Mar 2008 19:09
37 lines
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 
Technical Details
Message-ID: <47e0134c@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <47dffb86@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,f72145dd3e80e9f
X-Google-Attributes: gid10cc67,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <47dffb86@newsgroups.borland.com>
Subject: Re: Application directory
Date: Tue, 18 Mar 2008 12:09:09 -0700
Lines: 39
Organization: Lebeau Software
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.3138
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: 207.178.157.90
Message-ID: <47e0134c@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1205867340 207.178.157.90 (18 Mar 2008 12:09:00 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news2.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail