Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
relative paths
#21
Quote:......
well I think I see where the problem is, I am starting QB from "C:\qb45\qb.exe".
when I should be starting a QB.exe from the path of my project?
I did try this, it appeared to work at first. But when I moved the project folder to the desktop, it had the ever present missing files error.
I even wrote an error handling routine because it happens so often.
I'm sure I'm missing something, is there a chance some one can walk me through it?
First of all, I suggest you read Nathan's last post regarding the problems Qbers have with paths.

Personally, I have never had these problems because I use QuickBASIC 4.5 and never use QBasic. Like Nathan suggests, I have a PATH environment variable set to where my QuickBASIC compiler and libraries reside.

When I start a new project, I create a directory for it, and do all my work in that directory, which contains all my source code files, data files, batch files, and any utilities. I write the source code in this directory, compile, and obtain the executable files into this directory. When the programs make reference to any files, they do so without specifying any paths, only the filenames.

If this project is for a client, at the end, I may remove all the source code files before installing all the rest of the files in the directory onto the client's machine. The name of my original development directory doesn't need to be the same as that on the clients machine. Everything is "relative" to the directory on which it is installed.

I think you could compile your QB programs and obtain the same level of simplicity without having to worry where QB.EXE is at execution time.
*****
Reply
#22
Quote:It seems this post took on a life of it's own. :???:
I appologize for my long absence, I've been working hard on "The Sword of Arisan".
well I think I see where the problem is, I am starting QB from "C:\qb45\qb.exe".
when I should be starting a QB.exe from the path of my project?
I did try this, it appeared to work at first. But when I moved the project folder to the desktop, it had the ever present missing files error.
I even wrote an error handling routine because it happens so often.
I'm sure I'm missing something, is there a chance some one can walk me through it?

The full path to the desk top folder doesn't adhere to the DOS filenaming conventions. I suggest moving your project folder to the root directory or some other location where no directory name in the path to your folder is longer than eight characters.
Reply
#23
Wha?? "c:\windows\desktop" works in DOS here quite happily!

For a quick fix to your problem, there are three ways about it. The last two being different levels of difficulty for either you or the end user.

The first however, is to create a *.bat file in the working directory of your program.

Code:
cd c:\path\to\yourgame
c:\path\to\qb\qb.exe /(can't recall run or loadfile switch)yourfilename.bas

This file will set the working directory to the one you want, then load qb, then load in your program.

Another option is to use a configuration file (*.ini) for arguments sake. Everyone generally has a "c:" drive. I put a file.ini file in "c;" while building programs. Have the path there and make your program call that file and read in the path. Then add that to the start of the paths in your program.

The third option is the better for the end user. Create a "setup" program to allow people to manually set required settings. The setup program should also test the results, in this case, the path, and see if a particular file actually exists where it is claimed to.

I just thought of another one.

In your program, insert the following command and it's parameter:

Code:
SHELL "cd pathname"

But of course, that would still be hardcoding...

I recommend making the batch file to begin with, and execute your program with qb from that.
Screwing with your reality since 1998.
Reply
#24
Anarky, on Windows XP systems (and perhaps other NT based Windows versions) the desktop is stored in
\Documents and Settings\<user name>\Desktop
Reply
#25
And, for what it's worth, I wrote this batch file in the root directory, C:\ Its syntax is:
Quote:qbprog filename
Code:
cd c:\basic\qb\all prog files
..\qb/run %1
cd c:\
Ralph, using QuickBASIC 4.5 and Windows XP Home Edition and Service Pack 2, with HP LaserJet 4L printer.
Reply
#26
@ryankelly - True. I was talking about DOS based systems.
Screwing with your reality since 1998.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)