working-directory

Git: Where exactly is the “working directory”?

青春壹個敷衍的年華 提交于 2019-12-03 11:52:55
问题 I am going through some Git tutorials. The concept of a " working directory " keeps being mentioned, however, none of the tutorials or documents I read points out where or what this " working directory " is. I have thought that it was actually the .git 's parent directory, a.k.a the directory I run git init in. But the video tutorial I am watching talks about the state of nothing to commit and " working directory clean ": In fact you can actually make a copy of the repository, and make that

Directory based environment variable scope - how to implement?

本秂侑毒 提交于 2019-12-03 11:03:46
问题 I have a set of tools which I need to pass parameters depending on the project I'm working on. I'd like to be able to automatically set a couple of environment variables based on the current directory. So when I switched between directories, my commonly used env vars would also change. Example: Let's current directory is foo, thus if I do: ~/foo$ ./myscript --var1=$VAR1 VAR1 would have some foo based value. Then, let's say I switched to bar directory. If I do: ~/bar$ ./myscript --var1=$VAR1

Windows service - get current directory

自古美人都是妖i 提交于 2019-12-03 06:28:16
问题 I have a Windows service that should look for a configuration file in its current directory. So I use directory.getcurrentdirectiry() but instead of the service directory I get back c:\windows\system32 Any idea why and how should I get the service directory? 回答1: Don't use Directory.GetCurrentDirectory() . I had the same exact problem with C:\Windows\System32 being returned. Use this instead: Path.GetDirectoryName(Application.ExecutablePath); 回答2: You can set the current directory to the

Git: Where exactly is the “working directory”?

荒凉一梦 提交于 2019-12-03 04:39:35
I am going through some Git tutorials. The concept of a " working directory " keeps being mentioned, however, none of the tutorials or documents I read points out where or what this " working directory " is. I have thought that it was actually the .git 's parent directory, a.k.a the directory I run git init in. But the video tutorial I am watching talks about the state of nothing to commit and " working directory clean ": In fact you can actually make a copy of the repository, and make that copy so that it does not have a working directory, this is actually called the bare clone. This is

What's the difference between working directory and local repository?

[亡魂溺海] 提交于 2019-12-03 04:34:06
I've created a new GitHub repository. I'm quite confused by working directory and local repository. When working on my own, my stuff all resides on working directory. But when work with repo, I should check my stuff there. But are they the same thing? or should they be separate. Then how to commit my stuff in working directory to my local repo. How to commit my local repo to remote repo. How to do this by Git Bash? Thanks! Alexey Voytenko Working directory is the directory with your source files under git control (in the root of all dirs under control .git file is present). Git is tracking the

how to get the current working directory's absolute path from irb

女生的网名这么多〃 提交于 2019-12-03 01:36:03
问题 I'm running Ruby on Windows though I don't know if that should make a difference. All I want to do is get the current working directory's absolute path. Is this possible from irb? Apparently from a script it's possible using File.expand_path(__FILE__) But from irb I tried the following and got a "Permission denied" error: File.new(Dir.new(".").path).expand 回答1: Dir.pwd seems to do the trick. http://ruby-doc.org/core/Dir.html#method-c-pwd 回答2: File.expand_path File.dirname(__FILE__) will

Python in VSCode: Set working directory to python file's path everytime

时光总嘲笑我的痴心妄想 提交于 2019-12-02 22:44:47
问题 So I want to migrate from Spyder to VSCode, and I come across this problem where I cannot access a dataset as my working directory is not the same as the dataset's path. launch.json is not auto-generated for me as I'm not debugging anything (I tried this). How do I set the working directory to always be the dir of the Python file I want to run, in VSCode? (and if it's bad practice, could you show me a config that is easy to work with?) I'd like to set this up for VSCode's IPython terminal.

Windows service - get current directory

醉酒当歌 提交于 2019-12-02 19:58:22
I have a Windows service that should look for a configuration file in its current directory. So I use directory.getcurrentdirectiry() but instead of the service directory I get back c:\windows\system32 Any idea why and how should I get the service directory? Don't use Directory.GetCurrentDirectory() . I had the same exact problem with C:\Windows\System32 being returned. Use this instead: Path.GetDirectoryName(Application.ExecutablePath); You can set the current directory to the directory that your service is running from by including this line in your code: System.IO.Directory

How can Bash execute a command in a different directory context?

試著忘記壹切 提交于 2019-12-02 15:20:40
I have a common command that gets called from within very specific directories. There is only one executable sitting in /bin for this program, and the current working directory is very important for running it correctly. The script affects the files that live inside the directory it is run within. Now, I also have a custom shell script that does some things in one directory, but I need to call that command mentioned above as if it was in another directory. How do you do this in a shell script? You can use the cd builtin, or the pushd and popd builtins for this purpose. For example: # do

how to get the current working directory's absolute path from irb

谁说我不能喝 提交于 2019-12-02 13:53:23
I'm running Ruby on Windows though I don't know if that should make a difference. All I want to do is get the current working directory's absolute path. Is this possible from irb? Apparently from a script it's possible using File.expand_path(__FILE__) But from irb I tried the following and got a "Permission denied" error: File.new(Dir.new(".").path).expand Dir.pwd seems to do the trick. http://ruby-doc.org/core/Dir.html#method-c-pwd Psylone File.expand_path File.dirname(__FILE__) will return the directory relative to the file this command is called from. But Dir.pwd returns the working