• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 446
  • Last Modified:

Default path- default disk drive - error file

Normally I use my default path and error log file location hard coded in my main program.
If the environment is always stand alone we do not have any issues with this approach.
When we simultaneously have the same application deployed for stand alone and multi-user environments we need to change the code to redirect the default path and error file location (this is a DBF free table that I leave) from the C:\ drive to a shared network Drive named as W:\ for instance.
Can this locations and default disk os default path for Visual Fox be configured out of the code, I would say in the config file config.fwp?
0
luciliacoelho
Asked:
luciliacoelho
  • 4
  • 2
  • 2
1 Solution
 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
? JUSTDRIVE(SYS(2019,1))
0
 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
What I mean is follow where the config file is if that might solve your problem. If it's on F then you assign F.
0
 
pcelbaCommented:
If am using CONFIG.DBF which is placed in the same folder as the app.EXE and may contain data pathes and other info required at program start. If the CONFIG.DBF is empty or missing then I suppose data are in the DATA subfolder of the app folder retrieved by SYS(16) function call.

No hardcoded disk drive and/or path exists in the code. Thus, I may move the application together with data almost anywhere without any change in its code.

It is better to leave at operating system decision where to place temp files since Vista. I am using SYS(2023) to determine where to save text error logs and other temporary files. The error log is also replicated in DBF which is a standard part of the application data.
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
luciliacoelhoAuthor Commented:
Cyril Captain
I've tried "? JUSTDRIVE(SYS(2019,1))" and within a messagebox but nothing returned on my screen.
Something wrong on my side?
0
 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
It means that you don't have a config.fpw set up for the application.

I also do not hard code anything. I read the temp folders from the system and it behaves differently for 98/XP/Vista and 7.

The error and log files are in the main directory and there is the id of the user and email is sent upon confirmation of user. The error log can be dumped out on request.

You can also use SYS(16) to check where the program is executed from.
0
 
pcelbaCommented:
It just means your app or FoxPro does not use external CONFIG.FPW file.
0
 
luciliacoelhoAuthor Commented:
Pcelba,
I try to includ in config.fpw file the path i want to my application, but i donĀ“t know i can activate this file.
0
 
CaptainCyrilFounder, Software Engineer, Data ScientistCommented:
You create or edit it via notepad or FoxPro.
It needs to be in the same folder as the exe. Once you load the exe it loads with it.

In the development version, there might be another config.fpw which might or might contain the same settings. The other one is in the main folder of FoxPro and not your project.

You can force FoxPro to load a specific config.fpw by calling it with the -c parameter.

How to: Create a Configuration File
http://msdn.microsoft.com/en-us/library/377x0zxd(v=vs.80).aspx

Setting Configuration Options at Startup
http://msdn.microsoft.com/en-us/library/aa977194(v=vs.71).aspx
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now