You are not logged in.

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

1

Sunday, July 26th 2009, 1:59pm

Current Directory

Hi,
I noticed that the current working directory of a Jabaco application varies depending on how it is started.
If you first start the Jabaco IDE and then start your application using F6, you get a different WD compared to what you get double-clicking the project file and then starting the application. This reminds me of similar effects in the VB6 IDE.

Digging the internet about Java and current working directory, I've got the impression that this concept is regarded "not platform independent" and therefore "bad" in the Java community. But many existing VB6 implementations rely on CurDir() and ChDir(). In Java, there is a system property "user.dir", but this is more a read-only variable.

How should Jabaco handle the topic of working directories?

Greetings!

A1880

This post has been edited 1 times, last edit by "A1880" (Jul 26th 2009, 7:49pm)


OlimilO

Intermediate

  • "OlimilO" is male

Posts: 277

Date of registration: Jan 18th 2009

Location: Germany

Occupation: software engineer

  • Send private message

2

Sunday, July 26th 2009, 11:03pm

Hi A1880,


I do not think that it has something to do with Java, or even not with platform dependency.

  1. please give us a definition of "current working directory".
  2. please give us an example, in which ways did you use it.

Excerpts from the VB5-help



Quoted


CurDir Function

Syntax

CurDir[(drive)]

The optional drive argument is a string expression that specifies an existing drive. If no drive is specified or if drive is a zero-length string (""), CurDir returns the path for the current drive.



Quoted


ChDir Statement
Syntax

ChDir path

The required path argument is a string expression that identifies which directory or folder becomes the new default directory or folder. The path may include the drive. If no drive is specified, ChDir changes the default directory or folder on the current drive.

Remarks

The ChDir statement changes the default directory but not the default drive. For example, if the default drive is C, the following statement changes the default directory on drive D, but C remains the default drive:

ChDir "D:\TMP"

When someone asks me: I banned these functions and wiped them off my codes in 2001, because they lead to many errors in some windows-versions when using them in networks.

But they are part of the VB6-Framework and so they should be part of the Jabaco-Framework.

for using it from your Jabaco program it is very easy, simply hold an internal variable that stores the path, and when you write something with Print, Write or Put, the variable will be copied to the path to complete it, thats all - isn't it?.


regards

OlimilO

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

3

Monday, July 27th 2009, 12:58pm

Hi,
well, I haven't said good bye to the idea of current working directories. Obviously, it is always possible to keep track of the current WD using some global variable. But all API I'm aware of do accept relative and absolute paths. So, it would be only consequent to forbid relative paths altogether and enforce the usage of absolute paths. It is not just print, write, read. Think of other resources organized in filesystem or URL/UNC based directories.

Originally, a working directory was only assigned to a given process. Things get more complicated when it comes to multi-threading. Thread safety makes it necessary to have no WD at all or exactly one WD per thread.

To achieve VB6 compliance, ChDir and CurDir should at least work for the main thread.

Greetings!

A1880

Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

4

Monday, July 27th 2009, 7:00pm

Should we flood the directory through the exe-wrapper?

A1880

Intermediate

  • "A1880" is male
  • "A1880" started this thread

Posts: 500

Date of registration: Jan 1st 2009

Location: Hanover, Germany

Occupation: Software Engineer

Hobbies: Hilbert Curves

  • Send private message

5

Monday, July 27th 2009, 8:50pm

Hi Manuel,
"flood the directory through the exe-wrapper" sounds not feasible, but I don't have more than a vague picture what you mean by this.

The exe-wrapper unpacks itself to a temporary Jar which is then executed by by Java/JVM.
I don't know if and how one could possibly change the working directory of a running JVM.
But Jabaco could at least make sure that the JVM is started in the respective project directory for debugging regardless how you start Jabaco.

Cheers

A1880

This post has been edited 1 times, last edit by "A1880" (Jul 27th 2009, 10:15pm)


Manuel

Administrator

  • "Manuel" is male

Posts: 256

Date of registration: Jul 16th 2008

Location: Erlangen, Germany

Occupation: Software Developer

Hobbies: Jabaco, game theory, text-mining

  • Send private message

6

Monday, July 27th 2009, 9:05pm

Quoted

"flood the directory through the exe-wrapper" sounds not feasible, but I don't have more than a vague picture what you mean by this.
I can detect the exe-path with GetCurrentDirectory (http://msdn.microsoft.com/en-us/library/aa364934(VS.85).aspx) and I can set this value as param to the VM "-DEXEPath=%GetCurrentDirectory%".

Rate this thread
WoltLab Burning Board