I am Linux novice, I am working with some C++ code that opens files in the following directory:
home/scs/SCS/
My home directory in Linux is set to "home/scs" when I run printenv HOME from terminal:
Now, with terminal opened and running from "home", if do cd SCS
that works:
So, my terminal, in my screenshots, is it currently pointing at home/scs/SCS
? I don't think so.
What is confusing is that if we use the Ubuntu file explorer the home directory is just /home
:
If navigate to the SCS directory it is just /home/scs
:
So, in my C++ code, the value /home/scs/SCS
is valid and is used throughout the code, it is "built" in C++ using the following code:
#define SCS_HOME "/home/scs/" // Target Machine.
#define PATH_TO_SCS QString(SCS_HOME) + "SCS/"
How can /home/scs/SCS/
work? From my perspective the directory does not exist, but it is most certainly valid in the C++ code.
答案 0 :(得分:3)
So, my terminal, in my screenshots, is it currently pointing at home/scs/SCS ? I don't think so.
Why not? The directory is clearly listed in the output of ls
, and you even changed into it.
What is confusing is that if we use the Ubuntu file explorer the home directory is just /home
No, the dialog says that the location of your home directory (which is called /home/scs
) is /home/
. Your home directory is in /home/
; that's its location. It is /home/scs
.
If navigate to the SCS directory it is just /home/scs.
Yes, similarly, the SCS directory is found inside /home/scs/
. That's its location.
Here's your directory structure:
/
+--- home
| +--- scs
| | +--- SCS
What is confusing is that you created a user account named scs
, with a home directory /home/scs
, then put a directory named SCS
inside it. Seems like a bad name for the directory.
答案 1 :(得分:3)
Does your C++ code fail to correctly access the directory "/home/scs/SCS/"? Or are you having any other actual problems?
I looks like "SCS exists and is in the correct place.. Your file browsing tool is showing "SCS" to be inside of your home directory ( the popup says it's named "scs" and under "/home" )
When the shell says "~", that is an abbreviation for your home directory, which is, of course, "/home/scs".
It all matches.