Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

'C:\Program files' folder not recognized 4

Status
Not open for further replies.

SitesMasstec

Programmer
Sep 26, 2010
526
Brasil
Hi colleagues!

I use to distribute VFP9 applications inside InstallShield SETUP.EXE files to customers. In spite of the fact I advise them to change the installation folder to \INVOICES during the Setup installation, some users do not follow my instructions and install them in suggested folder (C:\Program Files\INVOICES\).

As my application has a folder \DATA inside the \INVOICES folder (\INVOICES\DATA), when the application has to read or save information in SYS(2003)+"\DATA\000001.DBF" it presents the error:

DO C:\PROGRAM FILES (x86)\INVOICES
"Program contains ubnrecognized phrase/keyword"


Problem is SYS(2003) cannot reflect C:\Program Files\INVOICES\ (where the user chose to install the application!)

Thank you,

SitesMasstec
 
Problem is:

It's not a problem.

If the target is inside the current folder, just use relative addressing:
Code:
Copy File (whatever) To "photos\whatever.jpg"

Notice I omit the leading backslash on the destination path. That tells the operating system to look for a folder with that name inside the current folder.

If you want to do it the best possible way STOP USING &MACRO EXPANSION ENTIRELY, as has been said many times in this thread. Spaces are not an issue if you use name expressions.

Code:
Copy File (whatever) To (FullPath(Curdir()) + "photos\whatever.jpg")

You're making this a problem.

 
I just want to say "What Dan said!" Do NOT use macro expansion when dealing with files and folders.

In addition, you should take a look at the set of functions whose names begin with Just and with Force. They make manipulating file names and paths much, much easier. Here's a link to an article I wrote about them:


Tamar
 
What's the problem, Sites Masstec? Change your code, and it won't error with spaces anymore. Everything you need has been explained.

Bye, Olaf.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top