# File Dialog Favorite based on path from environment var

**URL:** https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623
**Category:** Development
**Created:** [October 27, 2022, 8:04pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623 "2022-10-27T20:04:59Z")
**Posts on this page:** 17
**Page:** 1

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [October 27, 2022, 8:05pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/1 "2022-10-27T20:05:00Z")

</div>

We are working on an extension to the [Favorites list](https://discourse.paraview.org/t/favorite-panel-in-the-file-picker/7790) in the file dialog, based on [this issue](https://gitlab.kitware.com/paraview/paraview/-/issues/21236). Basically the proposal is to add an entry to Favorites which doesn’t point to a specific folder, but looks up a path from an environment variable. This is particularly useful for connecting to different HPC machines that might use the same env var, like $WORKDIR, to point to the fast storage space available to the user.

Discussion so far says there aren’t any conventional env vars that should be hard-coded - does that match people’s experience?

My thought is that this would be implemented with a dedicated button next to the existing “+” button, and a dialog would ask for a label and the env var. Then, if the env var was found and pointed to a path that exists, that item would be enabled.

What do you think?

---

<div class="post-metadata">

### Author: ![timothee.chabat](https://discourse.paraview.org/user_avatar/discourse.paraview.org/timothee.chabat/32/5729_2.png) [@timothee.chabat](https://discourse.paraview.org/u/timothee.chabat)
#### Post date: [October 28, 2022, 6:34am UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/2 "2022-10-28T06:34:04Z")

</div>

I think even if there is some standard env variable (which I’m not aware of) option 2 is more flexible so we should go with that. Ui seems seems reasonable

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [October 28, 2022, 11:14pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/3 "2022-10-28T23:14:57Z")

</div>

I’m not sure I see the point of this. Since any folder can be added as a favourite via a pop-up menu, when a folder is selected, why is that not sufficient?

The only problem I see is that adding a local folder as a favourite does not add it to the “Favourites” header in the file explorer dialog. Instead it appends it to the bottom of the folder list (in my case under Windows network).

---

<div class="post-metadata">

### Author: ![ben.boeckel](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.paraview.org/u/ben.boeckel)
#### Post date: [October 30, 2022, 4:07pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/4 "2022-10-30T16:07:46Z")

</div>

How persistent is this? If I launch with `WORKDIR=a` today, will it show up still if I launch without `WORKDIR` set? What if I relaunch with `WORKDIR=b`?

If we do this, something other than `Favorites` should be used. Can we add custom sections?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [October 31, 2022, 1:16am UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/5 "2022-10-31T01:16:33Z")

</div>

> [@todoooo](#):
>
> I’m not sure I see the point of this. Since any folder can be added as a favourite via a pop-up menu, when a folder is selected, why is that not sufficient?

> [@](#):
>
> How persistent is this? If I launch with `WORKDIR=a` today, will it show up still if I launch without `WORKDIR` set? What if I relaunch with `WORKDIR=b`?

$WORKDIR value can change, ParaView should read it everytime it launches (or everytime it open the dialog)

> If we do this, something other than `Favorites` should be used. Can we add custom sections?

Already too many sections imo.

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [October 31, 2022, 11:05pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/6 "2022-10-31T23:05:52Z")

</div>

> [@mwestphal](#):
>
> $WORKDIR value can change, ParaView should read it everytime it launches (or everytime it open the dialog)

So the user should edit an environment variable rather than editing the settings in Paraview? Why? Is it because there is no configuration file for the _Favourites_ settings that can be updated with a text editor?

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [November 1, 2022, 2:13pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/7 "2022-11-01T14:13:01Z")

</div>

> [@todoooo](#):
>
> So the user should edit an environment variable rather than editing the settings in Paraview?

That’s currently how some HPC users do things across different machines, and the idea is to support that use case, not change how settings are handled in ParaView for other favorite directories.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [November 1, 2022, 3:44pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/8 "2022-11-01T15:44:48Z")

</div>

For my use case, `$WORKDIR` is an environment variable pointing to my work directory on several different HPC machines. The actual path is different on most of these machines and as is the case with HPC machines there are hundreds if not thousands of users. All of these users have $WORKDIR=/a/b/c/ **username**. If you’re one of the lucky, alphabetically superior ones (e.g. **username** starting with “a” instead of “y” or “z”) then you don’t need to scroll through thousands of names to get to your work directory. Otherwise you have yet another pain point for getting to your work directory.

The other thing is that I don’t have to remember what `a`, `b`, `c` in the above example is. Also, new machines coming online will also use this `$WORKDIR` env convention.

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [November 2, 2022, 1:47am UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/9 "2022-11-02T01:47:39Z")

</div>

This sounds like something that should be configured at install time, not runtime, to me.

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 3, 2022, 2:21pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/10 "2022-11-03T14:21:41Z")

</div>

@Andy_Bauer Does your organization customize the ParaView settings on install? If you do…

An alternate implementation is to add a section to the Misc settings, which is a list of labels and env-vars, which would then be added to the Locations section. This is essentially how the “Home” directory works on Linux - it looks up the value of `getenv("HOME")`. Thanks @todoooo for the idea prompt…

The env-var value would be looked up each time the File dialog opened, and would show a warning icon if the directory doesn’t exist (just like Examples does now, for anyone running PV from a local build)

Does that sound better/worse that the icon in Favorites? It’s more hidden, but that seems appropriate, since it’s a specialist feature for connecting to multiple remote machines.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [November 3, 2022, 2:39pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/11 "2022-11-03T14:39:17Z")

</div>

We don’t customize ParaView settings on install, at least not currently, but I suppose it could be done.

Are we talking about the install on the server or the client? I’m just worried about an inconsistency there.

Is there an issue with this being available through an installation mechanism as well as through users being able to add the mechanism through settings?

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 3, 2022, 2:46pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/12 "2022-11-03T14:46:57Z")

</div>

Nope, there’s no issue - I was thinking that this would be a clear win if you were already customizing settings. This would be the client install - it only affects the user sitting in front of the client app. Customizing a setting is still pretty easy to include in a “getting started” checklist for your site, what do you think?

---

<div class="post-metadata">

### Author: ![todoooo](https://discourse.paraview.org/user_avatar/discourse.paraview.org/todoooo/32/2819_2.png) [@todoooo](https://discourse.paraview.org/u/todoooo)
#### Post date: [November 3, 2022, 10:35pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/13 "2022-11-03T22:35:47Z")

</div>

@aron.helser I like this solution.

---

<div class="post-metadata">

### Author: ![Andy\_Bauer](https://discourse.paraview.org/user_avatar/discourse.paraview.org/andy_bauer/32/5442_2.png) [@Andy\_Bauer](https://discourse.paraview.org/u/Andy_Bauer)
#### Post date: [November 4, 2022, 12:04pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/14 "2022-11-04T12:04:14Z")

</div>

Sounds good to me!

---

<div class="post-metadata">

### Author: ![cory.quammen](https://discourse.paraview.org/user_avatar/discourse.paraview.org/cory.quammen/32/11193_2.png) [@cory.quammen](https://discourse.paraview.org/u/cory.quammen)
#### Post date: [November 4, 2022, 2:59pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/15 "2022-11-04T14:59:27Z")

</div>

I like it, too!

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 4, 2022, 5:38pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/16 "2022-11-04T17:38:30Z")

</div>

Sounds good! I have a plan! I will summarize and proceed in [the PV issue](https://gitlab.kitware.com/paraview/paraview/-/issues/21236).

---

<div class="post-metadata">

### Author: ![aron.helser](https://discourse.paraview.org/user_avatar/discourse.paraview.org/aron.helser/32/13_2.png) [@aron.helser](https://discourse.paraview.org/u/aron.helser)
#### Post date: [November 10, 2022, 6:22pm UTC](https://discourse.paraview.org/t/file-dialog-favorite-based-on-path-from-environment-var/10623/17 "2022-11-10T18:22:55Z")

</div>

This has now been [added to PV](https://gitlab.kitware.com/paraview/paraview/-/merge_requests/5999), and is available in nightly builds.
