You are not logged in.

#1 2016-05-13 13:22:28

piedro
Member
Registered: 2013-04-11
Posts: 218

How to change the working directory of an application?

Hi!

How can I change the default working directory of an application in my home directory?

As default all these user based files by an applications usually sit in hidden folders in my home directory.
But still some applications clutter my home directory with non-hidden folders for storing the user specific files
like in "~/<Application Name>/".

Now how can I change this path to ~/.experiments/.<application-name>?

Thanks for help,
p.

Offline

#2 2016-05-13 15:48:39

TheChickenMan
Member
From: United States
Registered: 2015-07-25
Posts: 354

Re: How to change the working directory of an application?

Which applications are you trying to change?


If quantum mechanics hasn't profoundly shocked you, you haven't understood it yet.
Niels Bohr

Offline

#3 2016-05-13 15:51:21

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,561

Re: How to change the working directory of an application?

In many/most cases, this would need to be changed upstream.

Offline

#4 2016-05-13 16:13:22

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,796

Re: How to change the working directory of an application?

No guarantees,  but you might try running the program while passing in a new value for HOME.  It might work, it might fail epically wink

like this

ewaller@turing/home/ewaller % ls
bin    doc        Drive    flotsam  latex  multimedia  simulations  test.py  virtualization
devel  Downloads  Dropbox  hp48     mnt    Music       Sync         venv     x48
ewaller@turing/home/ewaller % cat test.py 
#! /usr/bin/python

import os

print ("HOME is %s"%os.environ['HOME'])
f1=open("%s/testFile"%os.environ['HOME'], 'w+')
print ("Hello World",file=f1)

    
ewaller@turing/home/ewaller % ./test.py 
HOME is /home/ewaller
ewaller@turing/home/ewaller % ls
bin    doc        Drive    flotsam  latex  multimedia  simulations  testFile  venv            x48
devel  Downloads  Dropbox  hp48     mnt    Music       Sync         test.py   virtualization
ewaller@turing/home/ewaller % rm testFile 
ewaller@turing/home/ewaller % mkdir test
ewaller@turing/home/ewaller % HOME=test ./test.py 
HOME is test
ewaller@turing/home/ewaller % ls test
testFile
ewaller@turing/home/ewaller % 

Last edited by ewaller (2016-05-13 16:19:31)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Online

#5 2016-05-13 19:12:48

2ManyDogs
Forum Fellow
Registered: 2012-01-15
Posts: 4,645

Re: How to change the working directory of an application?

libetc comes close to what you want, but it is marked as "unmaintained." rewritefs is suggested as an alternative.

(edit) after re-reading your first post several times, I think libetc isn't really what you want. I apologize for the noise.

Last edited by 2ManyDogs (2016-05-13 19:16:36)

Offline

#6 2016-05-13 21:40:43

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: How to change the working directory of an application?

This is sometimes a configurable option e.g. in my cower config, I can specify TargetDir, in makepkg.conf I can set PKGDEST etc.

Give one or two actual examples, rather than a generic question about application-name.

Offline

#7 2016-05-13 21:55:59

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: How to change the working directory of an application?

I would be surprised if applications are creating non-hidden directories in $HOME: that sounds like a bug.

For hidden dirs, see https://github.com/grawity/dotfiles/blo … iles.notes


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#8 2016-05-19 16:23:51

piedro
Member
Registered: 2013-04-11
Posts: 218

Re: How to change the working directory of an application?

Well, thx for all your comments.

I was not aware that this isn't a general setting. There should be imho. Otherwise how are you able to organize your home directory the way you want. Maybe you want to have all the application settings for private programs bundled in a folder ".private-stuff" for convenient backup and migration or easy cleanup if you move to another box.

This problem has been valid with a few which I do not remember all. The last one has been "arena-tracker" as installed from the AUR. This is an enhancement to Blizzards hearthstone and installs a folder ~/Arena Tracker.

I reported this to the subreddit cause I think this should be considered as a bug as well:
https://www.reddit.com/r/ArenaTracker/c … _in_linux/

thx again,
p.

Offline

Board footer

Powered by FluxBB