Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > The one pronoun problem

Reply
Thread Tools

The one pronoun problem

 
 
Chris Smith
Guest
Posts: n/a
 
      07-03-2005
<(E-Mail Removed)> wrote:
> Sounds very useful if one is writing Java code to run under Windows,
> but I was asking more in reference to using existing applications
> (e.g., MS Office). I'm guessing that some of them do have some notion
> of "current directory" that can maybe be changed via a command-line
> parameter, but the whole notion of "current directory" seems to be
> sort of alien to the GUI way of doing things. IMO, of course.


Nevertheless, the current directory does exist in Windows. You don't
generally change it with a command line parameter. Every Windows
application shortcut has a property for what directory it starts in.
Whether the application uses the current working directory for anything
or not is up to that application.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
 
Raymond DeCampo
Guest
Posts: n/a
 
      07-04-2005
Andrew Thompson wrote:
> On 3 Jul 2005 09:36:56 GMT, http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
>
>
>>>Roedy Green wrote:
>>>
>>>>..In windows there is only one current directory.

>>
>>There's a concept of "current directory" in Windows?

>
>
> System.getProperty("user.dir")
>


This gives the user's home directory, which is a different concept from
the current directory. To get the current directory, use new File(".").

>
>>Is there some trick I don't know about that would help ....?

>
>
> JFileChooser(File)/FileDialog.setDirectory(File)
>
> HTH
>


Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
 
 
 
blmblm@myrealbox.com
Guest
Posts: n/a
 
      07-04-2005
In article <(E-Mail Removed)>,
Chris Smith <(E-Mail Removed)> wrote:
><(E-Mail Removed)> wrote:
>> Sounds very useful if one is writing Java code to run under Windows,
>> but I was asking more in reference to using existing applications
>> (e.g., MS Office). I'm guessing that some of them do have some notion
>> of "current directory" that can maybe be changed via a command-line
>> parameter, but the whole notion of "current directory" seems to be
>> sort of alien to the GUI way of doing things. IMO, of course.

>
>Nevertheless, the current directory does exist in Windows. You don't
>generally change it with a command line parameter. Every Windows
>application shortcut has a property for what directory it starts in.
>Whether the application uses the current working directory for anything
>or not is up to that application.


I feel like we're not speaking quite the same language here. What I
mean by "current directory" is what you're likely to get with the
typical text-based Unix program launched from a command shell --
it can be different every time the program runs, and it's the basis
for specifying relative pathnames for the user's files. This is the
concept I find lacking in most GUIs, independent of operating system
(and I'm wondering whether it's because it's really not there, or
it's there and I just don't know how to get at it).

In contrast to this thing I'm calling "current directory", one
of these text-based programs might also have some notion of a home
directory (for itself), where it would find, oh, help files and such.
This directory would be the same for every invocation of the program.
It sounds like what you're calling the "current directory" for a
Windows application is more like this thing I'm calling "home directory
for itself" -- the same every time you launch the program, and hence
not so useful (IMO) as a starting point for relative pathnames for the
user's files.

But maybe I'm still not getting it?

--
| B. L. Massingill
| ObDisclaimer: I don't speak for my employers; they return the favor.
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      07-04-2005
<(E-Mail Removed)> wrote:
> I feel like we're not speaking quite the same language here. What I
> mean by "current directory" is what you're likely to get with the
> typical text-based Unix program launched from a command shell --
> it can be different every time the program runs, and it's the basis
> for specifying relative pathnames for the user's files.


Yes, that is also what I mean by "current directory". If you run a
Windows application from the command shell, then it will start out with
the same current working directory as the shell that started it, exactly
as with UNIX shell commands. I mentioned the shortcut thing only to
mention that, when you launch a Windows application from the Start menu,
for example, there still *is* a current working directory, even though
it's slightly more troublesome to change it (you'd have to edit the
shortcut from the Start menu). The concept still exists, but it is
slightly more hidden.

The current working directory is *not* an application-private thing.
It's not something that a process can choose to not implement. It is
always there, whether the application pays attention to it or not.
Several Win32 API and C standard library functions (and many other
libraries built on them) use it to resolve relative path names. The
JVM's File class uses it to resolve relative path names. Even though
the Windows task manager won't show it, I typically run a third-party
task manager application on Windows XP called TaskInfo, and it will tell
me the current working directory of any process I choose.

That's the current working directory, and it's what you get from
System.getProperty("user.dir").

Of course, an application can ignore its current working directory, and
many GUI applications do exactly that. Looking through TaskInfo, most
applications end up having the current working directory set to the
directory that contains their executable file, probably because that's
the default if you launch the application from a GUI interface and don't
specify anything different.

> This is the concept I find lacking in most GUIs.


Do you mean that you find the concept neglected in the user interface?
That's certainly true. It still exists, though, but is just slightly
behind the scenes.

> In contrast to this thing I'm calling "current directory", one
> of these text-based programs might also have some notion of a home
> directory (for itself) [...]


That is definitely different from the current working directory, and I'm
not talking about anything like that.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      07-04-2005
(E-Mail Removed) wrote:
> In article <(E-Mail Removed)>,
> Chris Smith <(E-Mail Removed)> wrote:
>
>><(E-Mail Removed)> wrote:
>>
>>>Sounds very useful if one is writing Java code to run under Windows,
>>>but I was asking more in reference to using existing applications
>>>(e.g., MS Office). I'm guessing that some of them do have some notion
>>>of "current directory" that can maybe be changed via a command-line
>>>parameter, but the whole notion of "current directory" seems to be
>>>sort of alien to the GUI way of doing things. IMO, of course.

>>
>>Nevertheless, the current directory does exist in Windows. You don't
>>generally change it with a command line parameter. Every Windows
>>application shortcut has a property for what directory it starts in.
>>Whether the application uses the current working directory for anything
>>or not is up to that application.

>
>
> I feel like we're not speaking quite the same language here. What I
> mean by "current directory" is what you're likely to get with the
> typical text-based Unix program launched from a command shell --
> it can be different every time the program runs, and it's the basis
> for specifying relative pathnames for the user's files. This is the
> concept I find lacking in most GUIs, independent of operating system
> (and I'm wondering whether it's because it's really not there, or
> it's there and I just don't know how to get at it).
>
> In contrast to this thing I'm calling "current directory", one
> of these text-based programs might also have some notion of a home
> directory (for itself), where it would find, oh, help files and such.
> This directory would be the same for every invocation of the program.
> It sounds like what you're calling the "current directory" for a
> Windows application is more like this thing I'm calling "home directory
> for itself" -- the same every time you launch the program, and hence
> not so useful (IMO) as a starting point for relative pathnames for the
> user's files.
>
> But maybe I'm still not getting it?
>


Windows does have the concept of a current directory. When it comes to
invoking shortcuts, the current directory of the process is set by the
shortcut. (That way you could set it to a useful place -- otherwise it
would be hardcoded and useless.) However, most Windows programs when
displaying a file chooser dialog, will start with the user's home
directory, the C:\ directory or My Computer. That is an issue with the
specific application, not the OS.

Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
blmblm@myrealbox.com
Guest
Posts: n/a
 
      07-04-2005
In article <(E-Mail Removed)>,
Chris Smith <(E-Mail Removed)> wrote:
> <(E-Mail Removed)> wrote:
>> I feel like we're not speaking quite the same language here. What I
>> mean by "current directory" is what you're likely to get with the
>> typical text-based Unix program launched from a command shell --
>> it can be different every time the program runs, and it's the basis
>> for specifying relative pathnames for the user's files.

>
>Yes, that is also what I mean by "current directory". If you run a
>Windows application from the command shell, then it will start out with
>the same current working directory as the shell that started it, exactly
>as with UNIX shell commands. I mentioned the shortcut thing only to
>mention that, when you launch a Windows application from the Start menu,
>for example, there still *is* a current working directory, even though
>it's slightly more troublesome to change it (you'd have to edit the
>shortcut from the Start menu). The concept still exists, but it is
>slightly more hidden.
>
>The current working directory is *not* an application-private thing.
>It's not something that a process can choose to not implement. It is
>always there, whether the application pays attention to it or not.
>Several Win32 API and C standard library functions (and many other
>libraries built on them) use it to resolve relative path names. The
>JVM's File class uses it to resolve relative path names. Even though
>the Windows task manager won't show it, I typically run a third-party
>task manager application on Windows XP called TaskInfo, and it will tell
>me the current working directory of any process I choose.
>
>That's the current working directory, and it's what you get from
>System.getProperty("user.dir").
>
>Of course, an application can ignore its current working directory, and
>many GUI applications do exactly that. Looking through TaskInfo, most
>applications end up having the current working directory set to the
>directory that contains their executable file, probably because that's
>the default if you launch the application from a GUI interface and don't
>specify anything different.
>
>> This is the concept I find lacking in most GUIs.

>
>Do you mean that you find the concept neglected in the user interface?

Yes, that's what I mean -- neglected to the point where it wasn't
obvious to me that it even existed. I asked in part because I wondered
if it really *was* there, but I wasn't noticing because I didn't know
the right incantations to invoke the behavior I want. From what you
say, though, it sounds like some application don't make use of it, so
maybe there are no such incantations ....

That aside, it does seem like maybe the whole idea isn't that useful
unless (1) the program is being launched from a command shell, which
now that I think of it I'm not sure I've ever done for a GUI-based
program under Windows, and/or (2) the program allows it be changed
during execution.

>That's certainly true. It still exists, though, but is just slightly
>behind the scenes.


>> In contrast to this thing I'm calling "current directory", one
>> of these text-based programs might also have some notion of a home
>> directory (for itself) [...]

>
>That is definitely different from the current working directory, and I'm
>not talking about anything like that.


Okay -- though if most applications just set the CWD to the directory
in which the executable lives, it could come to the same thing, no?

Anyway, thanks for the info -- not entirely on-topic for this group,
but helpful to me and perhaps some other lurkers.

--
| B. L. Massingill
| ObDisclaimer: I don't speak for my employers; they return the favor.
 
Reply With Quote
 
blmblm@myrealbox.com
Guest
Posts: n/a
 
      07-04-2005
In article <xl1ye.5450$(E-Mail Removed)>,
Raymond DeCampo <(E-Mail Removed)> wrote:
>(E-Mail Removed) wrote:
>> In article <(E-Mail Removed)>,
>> Chris Smith <(E-Mail Removed)> wrote:
>>
>>><(E-Mail Removed)> wrote:
>>>
>>>>Sounds very useful if one is writing Java code to run under Windows,
>>>>but I was asking more in reference to using existing applications
>>>>(e.g., MS Office). I'm guessing that some of them do have some notion
>>>>of "current directory" that can maybe be changed via a command-line
>>>>parameter, but the whole notion of "current directory" seems to be
>>>>sort of alien to the GUI way of doing things. IMO, of course.
>>>
>>>Nevertheless, the current directory does exist in Windows. You don't
>>>generally change it with a command line parameter. Every Windows
>>>application shortcut has a property for what directory it starts in.
>>>Whether the application uses the current working directory for anything
>>>or not is up to that application.

>>
>>
>> I feel like we're not speaking quite the same language here. What I
>> mean by "current directory" is what you're likely to get with the
>> typical text-based Unix program launched from a command shell --
>> it can be different every time the program runs, and it's the basis
>> for specifying relative pathnames for the user's files. This is the
>> concept I find lacking in most GUIs, independent of operating system
>> (and I'm wondering whether it's because it's really not there, or
>> it's there and I just don't know how to get at it).
>>
>> In contrast to this thing I'm calling "current directory", one
>> of these text-based programs might also have some notion of a home
>> directory (for itself), where it would find, oh, help files and such.
>> This directory would be the same for every invocation of the program.
>> It sounds like what you're calling the "current directory" for a
>> Windows application is more like this thing I'm calling "home directory
>> for itself" -- the same every time you launch the program, and hence
>> not so useful (IMO) as a starting point for relative pathnames for the
>> user's files.
>>
>> But maybe I'm still not getting it?
>>

>
>Windows does have the concept of a current directory. When it comes to
>invoking shortcuts, the current directory of the process is set by the
>shortcut. (That way you could set it to a useful place -- otherwise it
>would be hardcoded and useless.) However, most Windows programs when
>displaying a file chooser dialog, will start with the user's home
>directory, the C:\ directory or My Computer. That is an issue with the
>specific application, not the OS.


As I said in my response to the other reply (from Chris Smith) --
okay, this makes sense, and thanks!

--
| B. L. Massingill
| ObDisclaimer: I don't speak for my employers; they return the favor.
 
Reply With Quote
 
Raymond DeCampo
Guest
Posts: n/a
 
      07-04-2005
Raymond DeCampo wrote:
> Andrew Thompson wrote:
>
>> On 3 Jul 2005 09:36:56 GMT, (E-Mail Removed) wrote:
>>
>>
>>>> Roedy Green wrote:
>>>>
>>>>> ..In windows there is only one current directory.
>>>
>>>
>>> There's a concept of "current directory" in Windows?

>>
>>
>>
>> System.getProperty("user.dir")
>>

>
> This gives the user's home directory, which is a different concept from
> the current directory. To get the current directory, use new File(".").
>


My bad, I did not read the post carefully enough. I read "user.dir" and
my mind saw "user.home"...my apologies.

>>
>>> Is there some trick I don't know about that would help ....?

>>
>>
>>
>> JFileChooser(File)/FileDialog.setDirectory(File)
>>
>> HTH
>>

>
> Ray
>


Ray

--
XML is the programmer's duct tape.
 
Reply With Quote
 
Chris Smith
Guest
Posts: n/a
 
      07-04-2005
<(E-Mail Removed)> wrote:
> That aside, it does seem like maybe the whole idea isn't that useful
> unless (1) the program is being launched from a command shell, which
> now that I think of it I'm not sure I've ever done for a GUI-based
> program under Windows, and/or (2) the program allows it be changed
> during execution.


Yep. Regarding #2, I'm not even aware of a GUI app that actually
changes the current working directory. Generally, when a GUI app allows
you change some kind of default directory, it's keeping some private
directory in mind that's actually *not* the OS's idea of the CWD.

> Okay -- though if most applications just set the CWD to the directory
> in which the executable lives, it could come to the same thing, no?


Sort of, but it's never really safe to assume that the CWD will be the
directory containing the executable. I *do* very occasionally launch
GUI apps from a command line, and I'd be a bit peeved if they broke when
I did so.

--
www.designacourse.com
The Easiest Way To Train Anyone... Anywhere.

Chris Smith - Lead Software Developer/Technical Trainer
MindIQ Corporation
 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can one declare more than one signal on one line? Merciadri Luca VHDL 4 11-01-2010 02:00 PM
Nike air force one, air force 1, air force one low cut, air force one abdul_razak@indiatimes.com Digital Photography 2 12-31-2008 04:29 PM
Samsung SCD6040 - Anyone have one, used one, or have reviews on one? g wills Digital Photography 0 09-08-2004 08:06 PM
CSS aligning two things on one line with one left and one right news.frontiernet.net HTML 6 04-16-2004 02:44 AM
Using One XSLT and multiple XML Problem (One is XML and another one is XBRL) loveNUNO XML 2 11-20-2003 06:47 AM



Advertisments