I want to make a directory with a variable Path but it only works, if I put the name of the directory in quotation marks. But then the name of the directory isn't variable anymore. I can't find any solution for that. I want that the variable inside datei22 should get the name and path of the directory. datei22 is a char array.
Related
I need to set a wallpaper in a GPO and the file name must be wallpaper1. and the file extension is jpg.So is there any way to keep that dot in a filename?As I know wallpaper1..jpg is not a valid filename. Any suggestions how to keep that dot in a filename?
I know how to add values to the path variable, so my question is not how to use it.
Rather, I want to know how it works under the hood. When you type in the name of a program to execute, how does the system make use of PATH to find the matching program? How does it know when it finds a match?
for example...
when you set c:\python27\ into your environment path...
and you goto cmd, you are at c:\ and you type python
cmd knows to check the environment path which it will find c:\python27\ among others. then it looks for the command in each path listed in your environment paths
then executes the command if it finds it
simply the env path tells where to look for the command if it is not in the current directory
I am using copyItemAtPath:toPath:error: for copy operation. From documentation:
Symbolic links are not traversed but are themselves copied
but this method is traversing symbolic link and copying orignal content for Symbolic links created by ln -s(in 10.5).
kMDItemFSFinderFlags is zero for alias created by ln -s.
attributesOfItemAtPath:error: returns NSFileType = NSFileTypeSymbolicLink
From What's the difference between alias and link?
An alias contains two pieces of information: a unique identifier of
the file it links to, and the path and file name of the file it links
to.
If you rename or move a file, and then create a new file with the path
and file name that the file originally had, then any alias that linked
to the original file now links to the new file.
However, if you rename or move a file without replacing it, and then
invoke an alias, the alias is updated to point to the new path and
file name, making use of the unique identifier to do so.
A symbolic link, on the other hand, does not contain a unique
identifier to a file, and would appear as broken if the file is
renamed or moved and not replaced with a file of the same path and
file name.
when i am creating alias using
tell application "Finder"
make new alias at POSIX file "/Users/test/" to POSIX file "/Applications/Safari.app"
end tell
copyItemAtPath:toPath:error: is working fine and kMDItemFSFinderFlags = 33792.
attributesOfItemAtPath:error: returns NSFileType = NSFileTypeRegular;
Can anyone please help me out?
If this indeed a bug try using copyfile() (C function, man section 3) instead.
In an F# script file (.fsx), how can I determine the location of the .fsx file currently executing? I'd like to resolve paths relative to it.
I tried Assembly.GetExecutingAssembly().CodeBase but that doesn't work in a "dynamic assembly", apparently.
extract from F# spec:
__SOURCE_DIRECTORY__ - Replaced by a literal verbatim string that specifies the name of the directory that contains the current file, for example, C:\source. The name of the current file is determined by the most recent line directive in the file. If no line directive has been given, the name is determined by that given to the command-line compiler in combination with System.IO.Path.GetFullPath.
__SOURCE_FILE__ - Replaced by a literal verbatim string that contains the name of the current file, for example, file.fs
Is this method supposed to take a path as its argument?
It looks like it takes a filename as a path:
For example, /home/file.txt is a file, while /home/ is a path. This method looks like it takes the former as an argument.
Your distinction of "path" vs. "file" is not one that is common in Unix. Whether the final element of a path is a file or not doesn't affect the fact that it is a path. "/home/file.txt" looks like an absolute file path (though it could in fact be a deceptively named directory). "/home/" is an absolute directory path. Both are paths. (So is "foo/bar" — would you call that a "file" or a "path" in your terminology? Without inspecting the object at that path, we can't know whether it names a directory or a file.) Apple is using the term in its normal sense.
Yes, it takes a string that is a path - see the documentation:
Parameters
path
The path of a file or directory. If path begins with a tilde (~), it must first be expanded with stringByExpandingTildeInPath, or this method returns NO.
Note that /home/file.txt is a path, just like /home/. The former however is no directory, while the latter is.
If you're wanting to look for distinctions between files and folders, see -fileExistsAtPath:isDirectory:.
Usage:
BOOL isDirectory;
if ([self fileExistsAtPath:#"/Users/me/Subfolder" isDirectory:&isDirectory] && isDirectory)
{
// Exists and is a directory. Isn't that neat?
}