Modifying Edraw's Save Location

This is a relatively quick post. I’m a Linux user pragmatist. I firmly believe in the ideals of Free and Open Source Software, but I’m not opposed to paying for my software. Furthermore, when it comes down to it if I absolutely need to, I can accept having to use some proprietary tools provided they are functional and don’t inherently violate my privacy and my rights as a person.

All of this is a long winded way to say I’ve been looking at tools that are Visio-esque to help plan out the area I’d like to function as my office. Historically I would have done this with a tool like Inkscape, but I really wanted something a little more focused on the task at hand. I’m not a fan of having to manually manage the scale of the room.

Enter EdrawMax. They ship a Linux version, have a free trial, and offer a “pay once, use forever” version of their license, even if it is a bit expensive. This isn’t a review of the tool, but to a first order I’ve been pretty happy with the trial thus far. The big annoyance I’ve run into is Edraw’s insistence that all of its junk goes in the root of my $HOME directory, without offering a configuration option to place it elsewhere. Fortunately, Edraw uses a little bash script to run their tool, and a trivial modification fixes this problem.

To redirect the save point for the Edraw data, override $HOME in the context of the executable in this script. In my case, this means changing the script they provide from listing 1 below, to listing 2.

As-Shipped (Listing 1): /opt/EdrawMax-12/edrawmax.sh

export LD_LIBRARY_PATH='/opt/EdrawMax-12/lib/'
/opt/EdrawMax-12/EdrawMax "$@"

Modified (Listing 2): /opt/EdrawMax-12/edrawmax.sh

export LD_LIBRARY_PATH='/opt/EdrawMax-12/lib/'
_LOCAL_FAKE_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
if [[ ! -d "$_LOCAL_FAKE_HOME/Edraw" ]]; then
    mkdir -p "$_LOCAL_FAKE_HOME/Edraw"
fi
export HOME="$_LOCAL_FAKE_HOME"
/opt/EdrawMax-12/EdrawMax "$@"

With the above modification in place, both calling the script, and using the .desktop launcher the application installs onto your system will redirect that junk into ~/.local/share/Edraw.

Enjoy.


Last modified on 2023-07-24