Indigo Rose Software
  #1  
Old 11-05-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy

Where is the error?

Can you tell me why the first five lines using File.Copy don't work?

I have also attached a screen capture as well.

File.Copy("Setup\\ClassicIT\\1024boats.bmp", _WindowsFolder, true, true, false, true, nil);
File.Copy("Setup\\ClassicIT\\1024avon.bmp", _WindowsFolder, true, true, false, true, nil);
File.Copy("Setup\\ClassicIT\\classic.exe", _WindowsFolder, true, true, false, true, nil);
File.Copy("Setup\\ClassicIT\\OEM*.*", _WindowsFolder .. "\\System32\\", true, true, false, true, nil);
File.Copy("Setup\\ClassicIT\\OEM*.*", _WindowsFolder .. "\\System\\", true, true, false, true, nil);
File.Run("Setup\\screensav\\ClassicSCR.EXE", "", "", SW_SHOWNORMAL, true);
Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run ");
File.Open("Setup\\ClassicIT\\citslogo.reg", "", SW_SHOWNORMAL);
File.Open("Setup\\ClassicIT\\CitsURL.reg", "", SW_SHOWNORMAL);

Thanks for your help.

Regards,

John
Attached Images
File Type: png capture.png (47.8 KB, 33 views)
Reply With Quote
  #2  
Old 11-05-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Hi John. Setup\\ClassicIT\\1024boats.bmp isn't a valid file path because it lacks a drive assigment... I think this is the issue. I believe if you edit that to be a full file path it will work. Let me know.

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #3  
Old 11-06-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy

Hi Corey,

I've placed the Setup folder alongside the AutoPlay folder, rather than being in a subfolder. Thus the source path is created from the browse option within APMS5

Note that the others in that list, eg:

File.Run("Setup\\screensav\\ClassicSCR.EXE", "", "", SW_SHOWNORMAL, true);

works fine as a relative path.

I know that this is not File.Copy but File.Run - but I can't see why the difference?

The drive letter assignment for the installer has to remain relative; whether on CD or USB HDD, the default drive letter is automatically assigned by Windows.

I'm sure this is a bug?

Thanks for your help.

John
Reply With Quote
  #4  
Old 11-06-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
HI John. OK humor me for a sec, try it with _SourceFolder instead and let me know, i.e.:

File.Copy(_SourceFolder.."Setup\\ClassicIT\\1024bo ats.bmp", _WindowsFolder, true, true, false, true, nil);

I think that will work. As for the File.Run this is because that program runs on your system without full path from the start menu > run field. For example if I type "calc.exe" into my run field it runs windows calculator, I don't have to type the full path. Know what I mean? Strictly speaking you should use a full path here too BTW. As you see for both actions in the help file it says the first argument required by each function is a string containing, "The path to [...]".

It's worth noting the subtle difference between File.Run (Same as typing something into Windows start menu > run field) and File.Open (Same as double clicking on the file in Windows Explorer).

As for making links relative, no problem use the built in variables (listed in the help file) such as _SourceFolder or create your own custom path variables at startup... Hope that helps.

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #5  
Old 11-06-2003
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
Are you logged in with write access to the windows and system folders?
Reply With Quote
  #6  
Old 11-06-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy

Corey, no the _SourceFolder option doesn't work either.

(And yes, logged in as Administrator with write access to all files and folders. I had no problem with this in APMS4).

Thanks again.

John

PS I've attached a screen capture of the directory structure, with the Setup folder outside of the AutoPlay folder, both of which are in the CD_ROOT folder.

PPS I'm looking forward to finding out what's causing this...
Attached Images
File Type: png dir1.png (16.0 KB, 22 views)
Reply With Quote
  #7  
Old 11-06-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy

Hi Corey,

What I've discovered is that the following works:

File.Copy("AutoPlay\\ClassicIT\\1024boats.bmp", _WindowsFolder, true, true, false, true, nil);

However, there are two things that are apparent here.

The "wizard" in APMS5 automatically copies the image into "AutoPlay\\Images\\1024boats.bmp"

Now for technical reasons, I don't want the image stored in APMS5's default folder, so I manually re-type in \\ClassicIT\\ again as the original folder.

This works fine (incidentally without the need for _SourceFolder to be specified).

However, when copying from "Setup\\ClassicIT\\1024boats.bmp", a folder also in the root directory, the File.Copy fails.

I think we've found a bug in an otherwise excellent program.

Cheers,

John
Reply With Quote
  #8  
Old 11-06-2003
Corey's Avatar
Corey Corey is offline
Registered User
 
Join Date: Aug 2002
Posts: 9,746
Hmmm, OK, shouldn't have doubted you. You have been extremely helpful in searching out and squashing stuff, our gratitude as always John, you're a Klass act.

Corey Milner
Creative Director, Indigo Rose Software
Reply With Quote
  #9  
Old 11-06-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy behaviour

Corey/Lorne,

I've been testing the File.Copy in a variety of scenarios.

The following instance works, when not accompanied by any File.Copy instances:

File.Copy("Setup\\ClassicIT\\avon1024.jpg", "F:\\Temp\\aaawww\\", true, true, false, true, nil);


However, this doesn't work:

File.Copy("Setup\\ClassicIT\\1024*.bmp", _WindowsFolder, true, true, false, true, nil);


Neither work in the case where I have multiple File.Copy instances, such as:

File.Copy("Setup\\ClassicIT\\1024*.bmp", _WindowsFolder, true, true, false, true, nil);
File.Copy("Setup\\ClassicIT\\1024*.bmp", "F:\\Temp\\aaawww", true, true, false, true, nil);


I'm beginning to think that the issue isn't with locating the source file/folder. The difficulty is locating the _WindowsFolder and because of that when there are multiple File.Copy requests, nothing gets copied.

Hope this information is helpful.

Regards,

John
Reply With Quote
  #10  
Old 11-06-2003
Brett's Avatar
Brett Brett is offline
Indigo Rose Staff Member
 
Join Date: Jan 2000
Posts: 2,001
John,

Thanks for all of the research and reports. I will look into this today, find the bug and terminate it.
Reply With Quote
  #11  
Old 11-06-2003
Brett's Avatar
Brett Brett is offline
Indigo Rose Staff Member
 
Join Date: Jan 2000
Posts: 2,001
John,

I fixed that bug in the code today. For now, you will need to use:

File.Copy(_SourceFolder.."\\Setup\\ClassicIT\\1024 boats.bmp", _WindowsFolder, true, true, false, true, nil);

Note that this differs from Corey's code by the \\ in front of Setup\\ClassicIT\\1024boats.bmp. This should work for sure. Next release you will be able to do the relative path thing with no troubles.
Reply With Quote
  #12  
Old 11-06-2003
John_Klassek's Avatar
John_Klassek John_Klassek is offline
Indigo Rose Customer
 
Join Date: Dec 2001
Location: Northam, Western Australia
Posts: 85
File.Copy

Thanks Brett.

Yes, this now works!

Sure appreciate your looking into this.

Kind regards,

John
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -6. The time now is 07:16 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright © 2000 - 2009 Indigo Rose Corporation. All rights reserved.
Indigo Rose Software