Indigo Rose Software
  #1  
Old 01-02-2007
CPR CPR is offline
Forum Member
 
Join Date: Jan 2007
Location: Grass Valley, Ca
Posts: 3
file.copy issues

Is it possible to use relative file paths? I can't find anything on this subject, but it appears that a full path is always needed.

I need to copy a file from an Install directory up one directory (to the App dir.). The problem is that my patch is in the Install dir. I can reference the source file with:

_SourceFolder .. "\\test.txt"

but how do I reference the destination dir? The source dir is:

C:\Program Files\WCP\Install

and the destination dir is:

C:\Program Files\WCP

The only solution I can think of (without being able to use relative paths) is to have the patch in C:\Program Files\WCP. Then I should be able to reference the Install dir with something like:

_SourceFolder .. "\\Install\\test.txt"

Any suggestions?

Thanks for any help,

Chuck
  #2  
Old 01-03-2007
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
Quote:
Originally Posted by CPR View Post
Is it possible to use relative file paths? I can't find anything on this subject, but it appears that a full path is always needed.

I need to copy a file from an Install directory up one directory (to the App dir.). The problem is that my patch is in the Install dir. I can reference the source file with:

_SourceFolder .. "\\test.txt"

but how do I reference the destination dir? The source dir is:

C:\Program Files\WCP\Install

and the destination dir is:

C:\Program Files\WCP

The only solution I can think of (without being able to use relative paths) is to have the patch in C:\Program Files\WCP. Then I should be able to reference the Install dir with something like:

_SourceFolder .. "\\Install\\test.txt"

Any suggestions?
If the Program Files\WCP folder is the application folder location detected by your patch, you could use the %AppFolder% session variable like so:

Code:
SessionVar.Expand("%AppFolder%")
__________________
--[[ Indigo Rose Software Developer ]]

Last edited by Lorne; 01-03-2007 at 03:21 PM. Reason: Edited to say what I meant, and not what I said. :)
  #3  
Old 01-03-2007
CPR CPR is offline
Forum Member
 
Join Date: Jan 2007
Location: Grass Valley, Ca
Posts: 3
Isn't the AppFolder the one that I am running the patch from? In my case, the app folder is one folder higher. I am patching a file one folder below the app folder.
  #4  
Old 01-03-2007
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
_SourceFolder is where your patch is running from.

%AppFolder% is the root folder where your software is installed -- the location of the software to be patched. %AppFolder% is typically determined by your patch, normally in the On Startup script.

In order for your patch to work it needs to find and identify the software to be patched...so by definition %AppFolder% should already be pointing to this:

C:\Program Files\WCP

So your destination folder would just be SessionVar.Expand("%AppFolder%").
__________________
--[[ Indigo Rose Software Developer ]]
  #5  
Old 01-03-2007
CPR CPR is offline
Forum Member
 
Join Date: Jan 2007
Location: Grass Valley, Ca
Posts: 3
Thanks, I'll try that, although I don't know how the software is going to know that my app is installed in a higher directory. The file being patched is in a sub-dir and NO files in the "app" dir are referenced in the patch. This is because I need an unopened version of the Access database to patch, and I keep that file in my Install directory. After the patch, I copy the patched file up one dir and rename. Perhaps I need to set up VP differently. I guess that all this discussion means that relative paths are not supported.

Last edited by CPR; 01-03-2007 at 07:51 PM.
  #6  
Old 01-04-2007
Lorne's Avatar
Lorne Lorne is offline
Indigo Rose Staff Member
 
Join Date: Feb 2001
Location: Indigo Rose Software
Posts: 2,588
Quote:
Originally Posted by CPR View Post
Thanks, I'll try that, although I don't know how the software is going to know that my app is installed in a higher directory. The file being patched is in a sub-dir and NO files in the "app" dir are referenced in the patch.
Ah, in that case then %AppDir% will probably point to that sub-dir where the file you're patching is located.

Does your installer/application store any paths in the registry, or in the user profile? If so, you could read the location from there, and use that for the file copy.

You could also just parse the path (either _SourceFolder or %AppFolder%) using string functions to get the path to their parent folder.

In fact, here's a little function to do just that:
Code:
function GetParentFolder(FolderPath)
	local strPath = String.TrimRight(FolderPath, "\\");
	local nLastSlashPos = String.ReverseFind(strPath, "\\", true);
	return String.Left(strPath, nLastSlashPos-1);
end
Quote:
I guess that all this discussion means that relative paths are not supported.
Yeah, I checked the source code and there is a validation function that is rejecting anything that isn't formatted as an absolute path or UNC path. It looks to me like relative paths were supported at one point, and I'm pretty sure they would still work if they were allowed through. I've logged it as a bug to be addressed in the next minor update (REF: 14465).
__________________
--[[ Indigo Rose Software Developer ]]
 

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
File.Copy recursive error handling Buffman AutoPlay Media Studio 6.0 0 12-06-2006 01:56 PM
dialog.message and file.copy help dms AutoPlay Media Studio 6.0 2 08-09-2006 07:49 AM
File.Copy does not work as advertised tkilshaw Setup Factory 7.0 Discussion 2 05-18-2005 12:51 AM
Copyright Issues for "How To..." Training? sferguson General Chat 3 11-03-2004 04:51 PM
Media Player 9.0 Issues in AMS40 Brett AutoPlay Media Studio 4.0 0 01-23-2003 11:26 AM


All times are GMT -6. The time now is 06:14 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