After-the-dot-in-a-file-name, it is called extension.
It's called the basename. In fact, there's a unix/linux command for it:
basename - strip directory and suffix
from filenames
The "base name," "basename," "primary name," "filename," "file name," or the "file."
Base name or file name.
Ruby calls it the basename. That's a good, succinct name that I generally go with in other environments too.
Basename or primary file name.
I call it filename. So its like Filename.ext
I've always called the everything before the dot and the extension the "file name".
I'm not a Ruby or Linux guy, so I guess I missed the BaseName thing. It makes for all sorts of interesting naming convention hilarity. I'm in the
Filename.Ext
camp, although that, too can be a FileName. (or maybe a FileNameWithExtension).
Once upon a time, the term Leafname was used, although that typically included the extension.
I mention this for historical value, and since its dropped out of usage, it might be redeemable for this purpose.
The boost::filesystem library calls it basename as well.
Related
Background
I am trying to axe away some elements that are no longer needed in clearcase. I think I might have subverted some policy, becuase after I ran a rmbranch on the files I wanted to remove, each file ended up in this state:
/some/directory/##/main/dev/retired_branch_time_stamp/oldViewNum1234/1/file.txt##/main/dev/new_view_3425_nickname/1
I am familiar with /some/directory/element##/some/branch but not with the double "##" notation above. Hench my question...
Question
What does the something##something##something notation mean in clearcase?
As I mentioned in "Access labels of file through extended filename as directory", everything after the ## is a version-extended pathname (see pathnames_ccase )
Branch: element-pname##branch-pname
Version: element-pname##version-selector
So:
The first part /some/directory/##/ is a VOB-extended namespace directory
Then you have the pname followed by a version selector.
That does refer to the concept of "extended namespace":
An extension of the standard Windows or Linux or UNIX file system that allows access to versions of elements.
Having a path in a wxString variable, how do you append a subdirectory? Are there any specific functions for working with paths?
For those of you who know the Python language, there are nice functions like os.path.join("sub1", "sub2", "sub3"...) that joins the subX parts using the OS specific separator, and the os.path.split(path) that splits the path to the directory and the last name. The os.path.join() is nice even in situations when you are sure what separator can be used.
Thanks for your time and experience,
Petr
P.S. I am interested in the lastest wxWidgets version (2.9.4+).
wxFilename does what you need.
http://docs.wxwidgets.org/trunk/classwx_file_name.html
so, for example
wxFileName fname;
fname.AppendDir("sub1");
fname.AppendDir("sub2");
fname.SetName("test");
fname.SetExt("txt");
will create on windows
sub1\sub2\test.txt
Having a path (here Windows) like c:\MyPath\where\ the\part\of\it\does\not\exist. Is there any function in wxWidgeds that creates all the missing (bolded in the example) subdirectories, or do I have to write some on myself?
(If you know Python, the os.makedirs() is the equivalent.)
Thanks,
Petr
The easiest way to do this is to use the static function wxFileName::Mkdir and pass it the wxPATH_MKDIR_FULL flag.
I want to take a variable that has been set to a combination of path elements (potentially both absolute and relative) and get the absolute path from it. Something like what boost::filesystem::system_complete() does in C++. For example, I have something like:
set(EXTERNAL_LIB_DIR "${CMAKE_SOURCE_DIR}/../external" CACHE PATH "Location of externals")
which works but in the UI it's a bit ugly, as it might end up looking like C:/dev/repo/tool/../external. I'm wondering if there's a CMake built-in command to turn that into C:/dev/repo/external before I go and script a macro to do it. find_path kind of does this, but it requires that the path already exist and something worth searching for be there. I want it to work whether the path exists or not (I might use it for an overridden CMAKE_INSTALL_PREFIX default, for example).
You can use:
get_filename_component(NEW_VAR ${EXTERNAL_LIB_DIR} REALPATH)
As of CMake 3.20, you can use the cmake_path command to normalize the path, which supersedes the get_filename_component command.
cmake_path(SET MY_NEW_PATH NORMALIZE ${EXTERNAL_LIB_DIR})
This also converts any backslashes (\) into forward-slashes cleanly.
I'm running msbuild from the command line with the following:
msbuild mysolution.sln -p:outputdir=c:\mydir
When I run this, the outputdir is being ignored and the default specified in the csproj file is being used.
The MSDN doc for this tool says that I should be able to override the build directory using this parameter. What am I doing wrong?
You should use OutputPath and more important you should use the right syntax :
msbuild mysolution.sln /p:OutputPath=c:\mydir
Note that OutputPath is preferred over OutDir. The documentation used to be wrong about this, but I see that they've finally fixed it.
Beyond that, it's difficult to say exactly what the problem is, since you didn't show the exact path that you're passing as a parameter. There are two possible problems that I can imagine:
The OutputPath option specifies the path to the output directory relative to the project directory. That means you can't set it to a global path like C:\mydir. I assume it is unable to find the path you specified, and so it defaults to the one specified in your project file.
If the path that you're actually specifying as a parameter contains spaces, the command is likely to fail. I believe you need to wrap the path in quotes and append an extra backslash to the end of the path string.
I believe you should be using OutputPath.