mirror of
https://git.checksum.fail/alec/erythros
synced 2025-12-10 13:09:55 +02:00
System/Shell/Commands: Use original argv as pathname in error messages
This commit is contained in:
@@ -12,11 +12,10 @@ I64 @shell_cmd_aplay(@shell* sh, I64 argc, U8** argv)
|
||||
U8* filename = NULL;
|
||||
for (i = 1; i < argc; i++) {
|
||||
filename = @shell_expand_relative_path(sh, argv[i]);
|
||||
System.Log(Fs, "filename: %s", filename);
|
||||
if (FileSystem.PathExists(filename)) {
|
||||
snd = Audio.SoundFromFile(filename);
|
||||
if (!snd) {
|
||||
StrPrint(&buf, "%s: Error playing audio file\n", filename);
|
||||
StrPrint(&buf, "%s: Error playing audio file\n", argv[i]);
|
||||
Stdio.WriteLine(sh, &buf);
|
||||
Free(filename);
|
||||
return 1;
|
||||
@@ -25,7 +24,7 @@ I64 @shell_cmd_aplay(@shell* sh, I64 argc, U8** argv)
|
||||
Audio.FreeSound(snd);
|
||||
Free(filename);
|
||||
} else {
|
||||
StrPrint(&buf, "%s: No such file or directory\n", filename);
|
||||
StrPrint(&buf, "%s: No such file or directory\n", argv[i]);
|
||||
Stdio.WriteLine(sh, &buf);
|
||||
Free(filename);
|
||||
return 1;
|
||||
|
||||
@@ -32,7 +32,7 @@ I64 @shell_cmd_cat(@shell* sh, I64 argc, U8** argv)
|
||||
filename = @shell_expand_relative_path(sh, argv[i]);
|
||||
if (!FileSystem.PathExists(filename)) {
|
||||
res = 2;
|
||||
StrPrint(&msg, "cat: cannot access '%s': No such file or directory\n", filename);
|
||||
StrPrint(&msg, "cat: cannot access '%s': No such file or directory\n", argv[i]);
|
||||
Stdio.WriteLine(sh, &msg);
|
||||
} else {
|
||||
buf = FileSystem.ReadFile(filename, &size);
|
||||
|
||||
@@ -6,7 +6,7 @@ I64 @shell_cmd_ls_output(@shell* sh, U8* arg_path, I64 flags)
|
||||
U8 buf[512];
|
||||
U8* path = @shell_expand_relative_path(sh, arg_path);
|
||||
if (!FileSystem.PathExists(path)) {
|
||||
StrPrint(&buf, "ls: cannot access '%s': No such file or directory\n", path);
|
||||
StrPrint(&buf, "ls: cannot access '%s': No such file or directory\n", arg_path);
|
||||
Stdio.WriteLine(sh, &buf);
|
||||
Free(path);
|
||||
return 2;
|
||||
|
||||
Reference in New Issue
Block a user