mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-11 01:06:01 +03:00
ls: Emit hyperlinks for files outside the current directory
This commit is contained in:
parent
666863c2d8
commit
3667677008
Notes:
sideshowbarker
2024-07-19 06:45:27 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/3667677008c
@ -159,10 +159,10 @@ static String& hostname()
|
||||
return s_hostname;
|
||||
}
|
||||
|
||||
size_t print_name(const struct stat& st, const String& name, const char* path_for_link_resolution = nullptr)
|
||||
size_t print_name(const struct stat& st, const String& name, const char* path_for_link_resolution, const char* path_for_hyperlink)
|
||||
{
|
||||
if (!flag_disable_hyperlinks) {
|
||||
if (auto* full_path = realpath(name.characters(), nullptr)) {
|
||||
if (auto* full_path = realpath(path_for_hyperlink, nullptr)) {
|
||||
printf("\033]8;;file://%s%s\033\\", hostname().characters(), full_path);
|
||||
free(full_path);
|
||||
}
|
||||
@ -302,7 +302,7 @@ bool print_filesystem_object(const String& path, const String& name, const struc
|
||||
|
||||
printf(" %s ", Core::DateTime::from_timestamp(st.st_mtime).to_string().characters());
|
||||
|
||||
print_name(st, name, path.characters());
|
||||
print_name(st, name, path.characters(), path.characters());
|
||||
|
||||
printf("\n");
|
||||
return true;
|
||||
@ -382,7 +382,7 @@ bool print_filesystem_object_short(const char* path, const char* name, size_t* n
|
||||
return false;
|
||||
}
|
||||
|
||||
*nprinted = print_name(st, name);
|
||||
*nprinted = print_name(st, name, nullptr, path);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user