Запускатель и PATHEXT

Хотите говорить о Far и не знаете, куда обратиться?
User avatar
Smitis
Posts: 1709
Joined: Fri 18 Mar, 2005 12:51
Location: Питер
Has thanked: 23 times
Been thanked: 55 times

Запускатель и PATHEXT

Post by Smitis »

Latest post of the previous page:

DrKnS wrote: Wed 11 Nov, 2020 21:25 - Производится попытка запустить то, что вы ввели, системными средствами.
Только лучше наоборот, сначала lua, а потом системными средствами.
Разум когда-нибудь победит.
User avatar
John Doe
Бюрократ
Posts: 13801
Joined: Wed 27 Apr, 2005 20:42
Has thanked: 72 times
Been thanked: 425 times
Contact:

Запускатель и PATHEXT

Post by John Doe »

DrKnS wrote: Wed 11 Nov, 2020 20:12
DrKnS wrote: Wed 11 Nov, 2020 20:12 Если вас устраивает ситуация "ассоциации в комстроке работают при указании: 1. расширения; 2. пути, если запускаемый файл не в текущем каталоге"
Не очень устраивает.
DrKnS wrote: Wed 11 Nov, 2020 21:25 При необходимости можно возможность препроцессинга введенной команды и в API добавить.
Это уже интереснее, причём само по себе (как уже замечено выше).

Или же не выкидывать старый механизм запуска из кода совсем, а сделать опциональным.
https://t.me/FarManager — Telegram чат
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Ок, едем дальше:
- Должен снова работать поиск в path*pathext при запуске ассоциаций
- Обработка ассоциаций отключена по умолчанию. Включается по System.Executor.UseAssociations = true.
- При запуске исполняемых файлов из панелей по enter мигания не будет.
User avatar
HaRT
Moderator
Posts: 10806
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 220 times
Been thanked: 357 times

Запускатель и PATHEXT

Post by HaRT »

DrKnS wrote: Thu 12 Nov, 2020 23:06 При запуске исполняемых файлов из панелей по enter мигания не будет.
Встал на C:\Program Files (x86)\Windows NT\Accessories\wordpad.exe, перешёл в режим записи макроса, нажал Enterпанели моргнули, редактор запустился. При запуске C:\Windows\System32\notepad.exe и впрямь не моргают. (Ассоциаций .)
«Напарник, глянь, у нас мигалка работает? — Работает… не работает… работает… не работает…» :)
Фар есть инструмент, а не нянька. © 2009 DrKnS
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

HaRT, у вас нюх на баги 👍
Перевыложил.
User avatar
Smitis
Posts: 1709
Joined: Fri 18 Mar, 2005 12:51
Location: Питер
Has thanked: 23 times
Been thanked: 55 times

Запускатель и PATHEXT

Post by Smitis »

DrKnS
Из пользовательского меню по-прежнему не работает.
Разум когда-нибудь победит.
2useven10
Posts: 5192
Joined: Mon 07 Sep, 2009 10:40
Has thanked: 18 times
Been thanked: 309 times

Запускатель и PATHEXT

Post by 2useven10 »

DrKnS wrote: Thu 12 Nov, 2020 23:06Ок, едем дальше:
У меня просто после старта.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

2useven10, ваше падение . Видимо, где-то в профиле по умолчанию лежит устаревший custom lng с MListFileSize.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Smitis wrote: Fri 13 Nov, 2020 08:40Из пользовательского меню по-прежнему не работает.
Что именно?
User avatar
Smitis
Posts: 1709
Joined: Fri 18 Mar, 2005 12:51
Location: Питер
Has thanked: 23 times
Been thanked: 55 times

Запускатель и PATHEXT

Post by Smitis »

DrKnS
То же, что и в основной 5698 - при передаче списка cmd.exe /c echo "@!@U!"
Разум когда-нибудь победит.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Smitis, ок, поправил.
User avatar
Smitis
Posts: 1709
Joined: Fri 18 Mar, 2005 12:51
Location: Питер
Has thanked: 23 times
Been thanked: 55 times

Запускатель и PATHEXT

Post by Smitis »

DrKnS wrote: Tue 10 Nov, 2020 22:39 У меня вроде бы все работает, поэтому к концу недели все это вполне может оказаться в мастере и у всех, так что кричите, если что не так.
Теперь вроде бы работает. Конец недели наступил. Если что, "будем кричать". :)
Разум когда-нибудь победит.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Smitis wrote: Sat 14 Nov, 2020 15:18 Конец недели наступил. Если что, "будем кричать"
Ok, 5702
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

There is a new problem with 5702/5703/5704 which didn't exist in 5700.

When the executed command line contains parameters and ends with a <Space> character, FAR will pass an additional argument which points to an empty string. (pointer to a single \0 byte)

Example:
7z a test.7z file.txt (no <Space> after the "txt") ==> works fine
7z a test.7z file.txt (additional <Space> after the "txt") ==> Command line error: empty file path
7z.exe a test.7z file.txt (.EXE, no <Space> after the "txt") ==> works fine
7z.exe a test.7z file.txt (.EXE, additional <Space> after the "txt") ==> Command line error: empty file path
C:\7-Zip\7z a test.7z file.txt (full path, no <Space> after the "txt") ==> works fine
C:\7-Zip\7z a test.7z file.txt (full path, additional <Space> after the "txt") ==> Command line error: empty file path
C:\7-Zip\7z.exe a test.7z file.txt (full path and .EXE, no <Space> after the "txt") ==> works fine
C:\7-Zip\7z.exe a test.7z file.txt (full path and .EXE, additional <Space> after the "txt") ==> this one also works fine, even with <Space>

"space at the end" always happens when pasting some file or directory from the file panel to the command line with <Ctrl-Enter>.

The problem is not specific to 7-Zip, it also happens with RAR, GCC, MD5SUM, ...

Simple test program:

Code: Select all

#include <stdio.h>

int main(int argc, char **argv)
{
    for (int i = 0; i < argc; i++)
    {
        printf("Argument %d: [%s]\n", i, argv[i]); 
    }
}
c:\test a b c (with <Space> at the end):

Code: Select all

Argument 0: [c:\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
Argument 4: []
c:\test.exe a b c (with <Space> at the end and .EXE extension):

Code: Select all

Argument 0: [c:\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Запускатель и PATHEXT

Post by DrKnS »

Markus, Far doesn't pass "arguments" to programs.
It passes the whole string to the operating system.
And the operating system in turn passes the whole string to the program, which then parses it somehow, usually within its C runtime.

I can't reproduce your issue, everything just works in any combination.
I suggest extending the test program as follows:

  1.  #include <stdio.h>
  2.  
  3. +#include <windows.h>
  4.  
  5.  
  6.  
  7.  int main(int argc, char **argv)
  8.  
  9.  {
  10.  
  11. +    printf("Full command line: [%s]\n", GetCommandLine());
  12.  
  13.  
  14.  
  15.      for (int i = 0; i < argc; i++)
  16.  
  17.      {
  18.  
  19.          printf("Argument %d: [%s]\n", i, argv[i]);
  20.  
  21.      }
  22.  
  23.  }

- and comparing the full command lines instead, 5700 vs 5704 vs cmd.
Markus
Posts: 5
Joined: Mon 16 Nov, 2020 08:57

Запускатель и PATHEXT

Post by Markus »

5704:
c:\test a b c (with space at end)

Code: Select all

Full command line: ["c:\test.exe" a b c "]
Argument 0: [C:\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
Argument 4: []
c:\test.exe a b c (with space at end and .EXE)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
5700:
c:\test a b c (with space at end)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
c:\test.exe a b c (with space at end and .EXE)

Code: Select all

Full command line: ["c:\test.exe" a b c ]
Argument 0: [\test.exe]
Argument 1: [a]
Argument 2: [b]
Argument 3: [c]
The difference seems to be the additional " at then end of the command line.
Post Reply

Return to “Обсуждение Far Manager”