home-directory

How can I make Perl recognize paths with '~'?

被刻印的时光 ゝ 提交于 2019-12-07 05:51:19
问题 Possible Duplicate: How do I find a user's home directory in Perl? I'm running Ubuntu. Whenever I pass a Perl script a path that starts with ~ (e.g. ~/Documents/file.txt ) it fails finding it. I must pass the canonical path (e.g. /home/dave/Documents/file.txt ). Why is that? Can I make Perl recognize ~ paths? UPDATE All the suggested solutions include changing the code in the scripts. I would like for a solution that would not involve any changes to the scripts themselves (since not all of

How to make babun/cygwin home directory equal windows home directory?

杀马特。学长 韩版系。学妹 提交于 2019-12-05 09:14:47
I just installed babun, a variant of Cygwin. I want the cygwin user home directory to equal my windows home directory. So, to be clear, I don't want to add the cygwin home to the C:\Users as a new user, I want it to be the same as my current windows home directory. Now, according to this post, How can I change my Cygwin home folder after installation? , there is a neat way to make the cygwin home directory point to your windows home directory. You open the file /etc/nsswitch.conf and make sure is has a line db_home: windows . However, after restarting my pc, echo $HOME still says /home/chiel

How can I make Perl recognize paths with '~'?

我的梦境 提交于 2019-12-05 08:25:44
Possible Duplicate: How do I find a user's home directory in Perl? I'm running Ubuntu. Whenever I pass a Perl script a path that starts with ~ (e.g. ~/Documents/file.txt ) it fails finding it. I must pass the canonical path (e.g. /home/dave/Documents/file.txt ). Why is that? Can I make Perl recognize ~ paths? UPDATE All the suggested solutions include changing the code in the scripts. I would like for a solution that would not involve any changes to the scripts themselves (since not all of them are mine). Perhaps something in the way Bash works? The updated version of the question was posted

Swift: How to expand a tilde in a path String

只愿长相守 提交于 2019-12-04 02:45:50
How can I expand a path String with a tilde in Swift? I have a string like "~/Desktop" and I'd like to use this path with the NSFileManager methods, which requires the tilde to be expanded to "/Users/<myuser>/Desktop" . (This question with a clear problem statement doesn't exist yet, this should be easily findable. Some similar but not satisfying questions are Can not make path to the file in Swift , Simple way to read local file using Swift? , Tilde-based Paths in Objective-C ) Tilde expansion Swift 1 "~/Desktop".stringByExpandingTildeInPath Swift 2 NSString(string: "~/Desktop")

How to change home directory of Jenkins?

筅森魡賤 提交于 2019-12-02 22:14:51
Simple question: How to change the jenkins home directory location? By default it points to /var/lib/jenkins whereas I want it to point to /home/jenkins . I have changed my $JENKINS_HOME to /home/jenkins but it doesn't help me. Gonen Jenkins usually runs with its own user, so changing the home-dir of that user should do the job. If not sure, simply run a test-job with a shell-command like 'id' or 'whoami' or 'env' to find the user that Jenkins uses. Also, note that a message of " Started by user anonymous " does not mean that Jenkins started as an anonymous user - please see this related

Why can't I access this folder? [closed]

本小妞迷上赌 提交于 2019-12-02 17:26:24
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . A while back I bought a 1TB USB external drive. I formatted it ext4 in Ubuntu and copied a bunch of files / folders to it from several machines, all to /home/machinename/whatever, respectively. At some point I ran a chmod -R shell command on it to change the permissions. That was months ago and I don't remember

Why can't I access this folder? [closed]

五迷三道 提交于 2019-12-02 11:55:26
A while back I bought a 1TB USB external drive. I formatted it ext4 in Ubuntu and copied a bunch of files / folders to it from several machines, all to /home/machinename/whatever, respectively. At some point I ran a chmod -R shell command on it to change the permissions. That was months ago and I don't remember what I typed but it made the drive so I could only access its /home folder as root. This wasn't a problem because I could still access everything, but today I decided to try to fix it. I went to my shell as root, went to that drive and typed: chown -R rick:rick ./ chmod -R 666 ./ It

Getting home directory in Mac OS X using C language

我只是一个虾纸丫 提交于 2019-11-29 07:04:51
How can I get the path of home directory in Mac OS X using C language in XCode editor. #include <stdlib.h> #include <stdio.h> int main(void) { const char *homeDir = getenv("HOME"); if (homeDir) printf("Home directory is %s\n", homeDir); else printf("Couldn't figure it out.\n"); return 0; } This should work under Linux, Unix and OS X, for Windows you need to make a slight modification. #include <stdlib.h> #include <stdio.h> #include <pwd.h> #include <unistd.h> int main(void) { const char *homeDir = getenv("HOME"); if !homeDir { struct passwd* pwd = getpwuid(getuid()); if (pwd) homeDir = pwd->pw

How can I find the user's home dir in a cross platform manner, using C++?

蓝咒 提交于 2019-11-28 17:15:04
How can I find the user's home directory in a cross platform manner in C++? i.e. /home/user in Linux, C:\Users\user\ on Windows Vista, C:\Documents And Settings\user\ on Windows XP, and whatever it is that Macs use. (I think it's /User/user) Basically, what I'm looking for is a C++ way of doing this (example in python) os.path.expanduser("~") I don't think it's possible to completely hide the Windows/Unix divide with this one (unless, maybe, Boost has something). The most portable way would have to be getenv("HOME") on Unix and concatenating the results of getenv("HOMEDRIVE") and getenv(

Meaning of tilde in Linux bash (not home directory)

余生颓废 提交于 2019-11-28 03:13:51
First off, I know that ~/ is the home directory. CDing to ~ or ~/ takes me to the home directory. However, cd ~X takes me to a special place, where X seems to be anything. In bash, if I hit " cd ~ " and hit tab, it shows a bunch of possible ~X options like ~mail and ~postgres and ~ssh . Going to those folders and doing a pwd shows me that these folders are not in the home directory; they're all over the place. They are not aliases. I've checked. They're not env. variables, or else they'd require a $ . What is setting these links, and where can I find where these are being set? It's a Bash