Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Absolute path of the client #51

Open
nicolaje opened this issue Apr 12, 2014 · 2 comments
Open

Absolute path of the client #51

nicolaje opened this issue Apr 12, 2014 · 2 comments

Comments

@nicolaje
Copy link
Member

The call to "connect" should also send a command to the viewer (connect command?) containing the absolute path of the client program, retrieved via environment variables
(note: UNIX: $PWD, Windows: %CD%)
The viewer will need to know where the client is drawing from when image drawing will be implemented (or any functionality requiring access to local files).

@nicolaje
Copy link
Member Author

I am worried that it is complicated to automatically detect the executable path in a cross-platform way without external dependency in C++ [1]
It would also be language specific.
I propose the user has to explicitly call a command to set a "data path".
It can either be:

  • wrapped in the beginDrawing command (applies for all figures)
  • wrapped in a figure property (figure specific)
  • set as a separate command (applies for all figures)

What do you think?

[1] : http://stackoverflow.com/questions/143174/how-do-i-get-the-directory-that-a-program-is-running-from

@dvinc
Copy link
Contributor

dvinc commented Oct 28, 2015

I do not think we need to detect the executable path, getting the current working directory seems more appropriate (and easy ^^).
@nicolaje I agree with your idea to enable the user setting VIBes working directory with a command.

Here is my vision of VIBes working directory management:

  • It is a client-managed property: each client can have a different working directory
  • From the same client, it applies to all figures (keep it simple)
  • It is transmitted with each command that requires it, e.g. saving images, drawing images, etc...
  • The viewer decides to use the working directory information or not, depending if it receives an absolute or a relative filename
  • When beginDrawing is called, VIBes working directory is setup:
    • from a specific VIBES_WORKING_DIR environment variable if it is present,
    • otherwise from the client working directory (PWD or CD environment variable)
  • It can be modified by setWorkingDirectory command

Independently of this, the viewer could keep track of the last save file path for each figure, so as to present the file save dialog already targeting the right place if the figure as already been saved once (this should be the subject of a new improvement issue).

Feel free to comment

Below is a suggestion for an improved system (but let's first focus on the main issue)

We could also provide a finer grained system, by separating the data directory (from which images are read) from the export directory (where exported figures are written). This could be implemented in a second time, without breaking the setWorkingDirectory semantics.

  • additional setDataDirectory and setExportDirectory user commands in API
  • checking of VIBES_DATA_DIR and VIBES_EXPORT_DIR environment variables at startup.
  • setWorkingDirectory sets both the data and export directories.

It could be useful once image drawing will be implemented, since source images are often not located in the same folder as export.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants