WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Folder Creation
  Last Thread   Next Thread
Author
Thread Post New Thread    Post A Reply
IB53
Junior Member

Registered: Oct 2009
From: Alberta, Canada

Smile Folder Creation

I just installed NSIS and I'm trying to come to grips with things, I've read a lot of the documentation but there are still many things which are confusing me.
So my first question is regarding creating a folder. If I create a folder under (say) Userdata, and it already exists (for example the user runs the install twice or they have a folder of that name already), what happens? Does the install error out, does the user get a question or what?
What's the best way to prevent this happening, for example, should I be somehow testing for it's existence and taking appropriate action?
Any examples would be more than welcome!

many thanks,, and,, "Hello!" nice to meet you all.

Ian

Quick Link | Report this post to a moderator | IP: Logged

IB53 is offline Old Post 11-04-2009 06:19 AM
Click Here to See the Profile for IB53 Click here to Send IB53 a Private Message Find more posts by IB53 Add IB53 to your buddy list Edit/Delete Message Reply w/Quote
MSG
Senior Member

Registered: Oct 2006
From:

Re: Folder Creation

quote:
If I create a folder under (say) Userdata, and it already exists (for example the user runs the install twice or they have a folder of that name already), what happens? Does the install error out, does the user get a question or what?

Answer 1) http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.1.9 or http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.3.3
Answer 2) Why don't you just try it, and see what happens? That would be a lot faster than posting in the forums...

Quick Link | Report this post to a moderator | IP: Logged

MSG is offline Old Post 11-04-2009 07:49 AM
Click Here to See the Profile for MSG Click here to Send MSG a Private Message Find more posts by MSG Add MSG to your buddy list Edit/Delete Message Reply w/Quote
IB53
Junior Member

Registered: Oct 2009
From: Alberta, Canada

Thank you for your reply.

To answer your question - because no matter what the answer to "what happens if" I would not have known what to do about it so i would still have had to post a question to answer that.

Even after having looked again at the page you reference I'm still unsure of the answer, as I said, I have read the documentation.

Quick Link | Report this post to a moderator | IP: Logged

IB53 is offline Old Post 11-05-2009 03:42 AM
Click Here to See the Profile for IB53 Click here to Send IB53 a Private Message Find more posts by IB53 Add IB53 to your buddy list Edit/Delete Message Reply w/Quote
CG!
Junior Member

Registered: Nov 2009
From:

i'm new to NSiS too and that's what i figured out from learning by doing:
if your install trys to create a folder that already exists, nothing happens. No error message, nothing. So if you install into a sensitive folder, check if it already exists first or use user confirmations when a file as to be replaced.
if you try to delete a folder that has still files in it, nothing will be deleted and no error comes up.
if you got a folder tree like this:
Root
-- Files
-- Subfolder #1
---- Subfolder #2
------ Files
then you'll gave to create Subfolder #1 first. i know, that's basic knowledge but easy to forget because NSiS does not create Subfolder in not existing folder. With other words: nothing will be done and no error comes up. Same count's for deleting folder. You can't just RMDir the root if there are still files or subfolders in it.
DOS style i say ... a least it what it looks like to me. ^^

Hope i could help a bit or more.

Quick Link | Report this post to a moderator | IP: Logged

CG! is offline Old Post 11-05-2009 04:06 AM
Click Here to See the Profile for CG! Click here to Send CG! a Private Message Find more posts by CG! Add CG! to your buddy list Edit/Delete Message Reply w/Quote
MSG
Senior Member

Registered: Oct 2006
From:

quote:
Originally posted by CG!
NSiS does not create Subfolder in not existing folder.

This is not true. Read the documentation.

IB53: What you would have to do to 'try it out yourself', is something like this:

ClearErrors
CreateDirectory "C:\YourPath\YourExistingSubDir"
${If} ${Errors}
MessageBox MB_OK "Error!"
${Else}
MessageBox MB_OK "No error."
${EndIf}

That way, you'll know whether or not NSIS raises the error flag in this situation. You will also see whether or not the user is shown an error/question in this situation. (Spoiler: The user won't see a thing, and no error flag is set.)

Once you know the above two pieces of information, you'll also know that you don't have to do anything to 'prevent it', because nothing goes wrong in the first place.

As you can see, it would've been much quicker to just test this thing out and see what happens.

Quick Link | Report this post to a moderator | IP: Logged

MSG is offline Old Post 11-05-2009 08:04 AM
Click Here to See the Profile for MSG Click here to Send MSG a Private Message Find more posts by MSG Add MSG to your buddy list Edit/Delete Message Reply w/Quote
CG!
Junior Member

Registered: Nov 2009
From:

Creating subfolders in not axisting folders doesn't work for me and it's what i discovered by doing instead of reading.
i'm still new to NSiS, so there's alot to learn left.

quote:
Originally posted by MSG
code:
ClearErrors CreateDirectory "C:\YourPath\YourExistingSubDir" ${If} ${Errors} MessageBox MB_OK "Error!" ${Else} MessageBox MB_OK "No error." ${EndIf}


This wasn't the question ... i think.
As far as i understood, he wanted to know if NSiS displays error messages on itself.
So my answer was "No" for the mentioned cases.
That it's possible to catch a possible error is common knowledge and a must have.

Quick Link | Report this post to a moderator | IP: Logged

CG! is offline Old Post 11-05-2009 09:54 AM
Click Here to See the Profile for CG! Click here to Send CG! a Private Message Find more posts by CG! Add CG! to your buddy list Edit/Delete Message Reply w/Quote
All times are GMT. The time now is 04:39 AM. Post New Thread    Post A Reply
  Last Thread   Next Thread
WINAMP.COM | Forums : Powered by vBulletin version 2.3.9 WINAMP.COM | Forums > Developer Center > NSIS Discussion > Folder Creation
Show Printable Version
 | 
Email this Page
 | 
Subscribe to this Thread

Forum Jump:
 

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is off
vB code is ON
Smilies are ON
[IMG] code is ON