PDA

View Full Version : How to Catch Access is denied Error



SaintBernard
01-21-2009, 10:32 AM
During my install I am copying an Adobe file *.joboptions
To C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings

But the directory is set to Read Only.
The odd thing is I get the error message:

Feature: Adobe Acrobat 9.0
Component: Adobe Acrobat 9.0joboptions
File: C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\MYFILE.joboptions
Error: Access is denied

I get this message twice then the install exits but the funny thing is, that it manages to copy the file.

So do I:
1. Just try to catch this error?
2. Tell install in some way to ignore read only?
3. Set the directory attribute before copying then set it back?

And how do I do this?

SaintBernard
01-23-2009, 11:34 AM
Wow I discovered the fix for

Feature: Adobe Acrobat 9.0
Component: Adobe Acrobat 9.0joboptions
File: C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\MYFILE.joboptions
Error: Access is denied

I had to set the "Potentially Locked property " to yes

I sure wish it had given a better error message.

SaintBernard
03-11-2009, 01:03 PM
That did not fix the problem.

What I find is before it errors it has already copied the file.

Then it errors again.

So then I abort and reinstall and the file is already present and it installs
with out error.

I have not been able to --
1. Catch this error?
2. Tell install in some way to ignore read only?


The only fix I can think of is to Xcopy the file on my own.

joshstechnij
03-12-2009, 02:05 PM
Have you tried overriding the OnFileError and OnFileReadOnly events in your script? These events should allow you to catch access denied or other errors encountered during file transfer.

SaintBernard
03-13-2009, 08:46 AM
Yes I have both OnFileError and OnFileReadOnly events overridden in my script, with MessageBox to let me know if they are hit. Nether get called.

I have the file set for potentially locked.

As I said the first install even though it gives me the
---------
Feature transfer error
Feature: Adobe Acrobat 9.0
Component: Adobe Acrobat 9.0joboptions
File: C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\MYFILE.joboptions
Error: Access is denied
------

twice. But it still copies the file. So the second time it installs fine.

My only solution I can think of is to simply copy the file with
CopyFile. I will try that to see if I get errors.

joshstechnij
03-13-2009, 06:22 PM
You may try using CopyFile or XCopyFile, but since these functions share code with the standard file transfer functionality, they may also encounter errors copying the file.

Is there any way you can provide a way to reproduce this behavior?

SaintBernard
03-18-2009, 09:35 AM
You may try using CopyFile or XCopyFile, but since these functions share code with the standard file transfer functionality, they may also encounter errors copying the file.

Is there any way you can provide a way to reproduce this behavior?

I used XCopyFile and even though it returned the error it copied the file.
This is what I was seeing with "Feature transfer", but I can ignore the error and complete the install. I was not happy with this.


Even though I have administrative rights. The directory "C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF" is set to "Read & Execute" , "List Folder Contents" , and "Read". The "Write" is turned off.
The directory I am trying to write too is C:\Documents and Settings\All Users\Application Data\Adobe\Adobe PDF\Settings\

I don't know if this is why I am getting the false errors or why it copies anyhow.

So I had two options change the permissions, then write the file, then change the permissions back, or simply change my application to specify where the .joboptions file is located. It was safer and easier to change the application, and copy the .joboptions file to my <TARGET> directory.