PDA

View Full Version : Copying file



NewsArchive
01-22-2016, 01:55 AM
Hi Friedrich,

I am trying to copy a file to my install folder. The goal is to copy the
file either from another product installation folder or from a network
share.
It seems no matter what I do the copy is failing.
I have used If File Exists to confirm the file is really there. I've tested
both a network share and a local folder on the system running the install.
The destination folder is the installation folder for the product I'm
installing.
I've tried copying both before and after the Register all pending file
operations in case that had an impact.
The file does not exist in the target folder.

I turned on the SBEvents but it does not include the actual error code for
the copy. Just that it did not succeed. Here are the relevent lines.
|01/21/2016|16:52:12.620|@DISPLAYMESSAGE estimator path C:\Users\rickm_000\Desktop : Debug
|01/21/2016|16:52:14.196|Set Variable %_SB_RETURN% to 1
|01/21/2016|16:52:14.196|@DISPLAYMESSAGE Copying C:\Users\rickm_000\Desktop\ESIMATE.SIN\nto "C:\Program Files\SharpeSoft Email Server" : Debug
|01/21/2016|16:52:17.222|Set Variable %_SB_RETURN% to 1
|01/21/2016|16:52:17.222|@COPYMOVEFILE[1] C:\Users\rickm_000\Desktop\ESIMATE.SIN
|01/21/2016|16:52:17.222|Set Variable %_SB_RETURNEX% to 0
|01/21/2016|16:52:17.222|@DISPLAYMESSAGE Error copying estimate.sin : Debug

Anything you can point me towards?
It seems like this should be really simple but it is kicking my butt.

Thanks,
Rick

NewsArchive
01-22-2016, 01:55 AM
Have you been checking for %_SB_ERRORCODE% ?

Jeff Slarve
www.jssoftware.com
Twitter free since Jan 11, 2016
I'll search help files & Google for you.

Grammar troll's, are the worse.

NewsArchive
01-22-2016, 03:47 AM
Hi Rick,

> I am trying to copy a file to my install folder. The goal is to copy the
> file either from another product installation folder or from a network
> share.

You are trying to copy from a mapped drive to a local drive, right? Mapped
drives are always associated with a logon session, not a machine! A locally
unique identifier (LUID) identifies a logon session and a LUID is generated
for each logon session. Because mapped drives are associated with LUID, and
elevated applications are using a different LUID generated during a separate
login event, the elevated application will no longer see any mapped drives
for this user. The elevated and non-elevated administrator accounts have
completely different logon tokens and can therefore have different drive
mappings. That means, a process running non-elevated and another process
running elevated are a part of two distinct logon sessions. As such, if a
drive was mapped in a non-elevated context, it will never be visible to an
elevated context, unless the drive is also mapped in the elevated context.

To cut a long story short <g>, the ("per-user") mapped drive is not visible
or accessible to the elevated running ("per-machine") SETUP.EXE.

Does this help? If it is not a mapped drive issue, please shout <g>

Friedrich

NewsArchive
01-22-2016, 11:06 AM
Hi Jeff,

I am checking %_SB_ERRORCODE%. It returns 0 for a failure. That does not
give me an indication of the reason for failure.

Thanks,
Rick

NewsArchive
01-22-2016, 11:08 AM
Hi Friedrich,
It is not a mapped drive. The path I'm using is a UNC and the user is
selecting through a dialog in the install, so they definity have access to
it from wihtin the program.

Rick

NewsArchive
01-22-2016, 11:09 AM
> Hi Friedrich,
>
> I am trying to copy a file to my install folder. The goal is to copy the
> file either from another product installation folder or from a network
> share.
> It seems no matter what I do the copy is failing.

Well, as usual the problem is between the chair and the keyboard.
I had a typo in the file name in the copy statement.
So it always failed because the file name was wrong and did not exist.
The file name was correct in my File Exits check but not in the copy
statement.
That will hopefully teach me to use hard-code strings in multiple places in
my script.
I've replaced the filename string with a variable now through out.

My Afternoon Brain just couldn't see the issue. Morning Brain saw it
immidiately. :)

Thanks,
Rick

NewsArchive
01-24-2016, 04:12 AM
Hi Rick,

> Well, as usual the problem is between the chair and the keyboard.

<g> I am glad it's working fine now.

Friedrich