Creates the hard link link to the existing file filepath, so both names are one file. Note the order: the new name
comes first. Fails if link exists, on a directory, or across volumes or on a file system without hard links.
file_link :: (link: string, filepath: string) -> bool
Parameters
- link: string
- filepath: string
Returns
- bool
#import "Extensions/Environment";
base := environment_variable("TMPDIR");
if base == "" base = environment_variable("TEMP");
if base == "" base = "/tmp";
path := tprint("%/jai-doc-link.bin", base);
defer file_delete(path);
other := tprint("%.link", path);
defer file_delete(other);
assert(write_entire_file(path, "shared"));
assert(file_link(other, path));
text, ok := read_entire_file(other);
assert(ok && text == "shared");
free(text);Doesn't run in the browser (only on windows).