On copy I get a "\n" after file path. How to fix?

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

Post Reply
B@ron
Junior Member
Junior Member
Posts: 13
Joined: 2015-10-07, 20:42 UTC

On copy I get a "\n" after file path. How to fix?

Post by *B@ron »

Hi.

i use button to copy path file and get a "\n" after path file, can you fix it? This creates problems when using terminal emulators - connect bot, better terminal emulator, etc
Last edited by B@ron on 2015-10-08, 09:40 UTC, edited 1 time in total.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Hmm, there is no such command. Or do you mean "121 Copy names to clipboard"? This is for copying selected file names.
Author of Total Commander
https://www.ghisler.com
B@ron
Junior Member
Junior Member
Posts: 13
Joined: 2015-10-07, 20:42 UTC

Post by *B@ron »

ghisler(Author) wrote:Hmm, there is no such command. Or do you mean "121 Copy names to clipboard"? This is for copying selected file names.
no, 122

i copy paths + filenames, after last string inserted "\n" (newline) :(
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

I see - all names are indeed separated by line breaks. It's debatable whether there should be a break after the last line or not...
Author of Total Commander
https://www.ghisler.com
B@ron
Junior Member
Junior Member
Posts: 13
Joined: 2015-10-07, 20:42 UTC

Post by *B@ron »

ghisler(Author) wrote:I see - all names are indeed separated by line breaks. It's debatable whether there should be a break after the last line or not...
After a single line - no :) after many lines - may be needed
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Post by *DrShark »

B@ron wrote:
ghisler(Author) wrote:I see - all names are indeed separated by line breaks. It's debatable whether there should be a break after the last line or not...
After a single line - no :) after many lines - may be needed
I agree. If one file or folder name copied with one of TC4A copy names commands, TC4A should't add \n because this extra character must be removed then manually each time when pasting it into a New text file or New folder dialog.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
B@ron
Junior Member
Junior Member
Posts: 13
Joined: 2015-10-07, 20:42 UTC

Re: On copy I get a "\n" after file path. How to fix?

Post by *B@ron »

This issue is still relevant. Adding a newline when copying a single full file path creates problems. Can you fix this ? Maybe an additional setting in the options ?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: On copy I get a "\n" after file path. How to fix?

Post by *ghisler(Author) »

Should I remove the \n at the end just when there is one file, or always?
Author of Total Commander
https://www.ghisler.com
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: On copy I get a "\n" after file path. How to fix?

Post by *Usher »

2ghisler(Author)
Remove \n only for a single line. In other cases some programs may ignore the last line if it's not ended with proper EOL mark (treat incomplete line as unfinished command, broken transmission etc.)
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Stefan2
Power Member
Power Member
Posts: 4132
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: On copy I get a "\n" after file path. How to fix?

Post by *Stefan2 »

ghisler(Author) wrote: 2021-08-02, 15:54 UTC Should I remove the \n at the end just when there is one file, or always?
Me think "always", if there is one line only or is it the last line of many lines.






 
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: On copy I get a "\n" after file path. How to fix?

Post by *ghisler(Author) »

some programs may ignore the last line if it's not ended with proper EOL mark
You have a valid point here, so I will do that.
Hopefully they will not ignore single files then...
Author of Total Commander
https://www.ghisler.com
B@ron
Junior Member
Junior Member
Posts: 13
Joined: 2015-10-07, 20:42 UTC

Re: On copy I get a "\n" after file path. How to fix?

Post by *B@ron »

ghisler(Author) wrote: 2021-08-02, 15:54 UTC Should I remove the \n at the end just when there is one file, or always?
I apologize for the delay in answering, I did not receive a notification in the mail. Yes, you need to remove it only when copying the name or full path of a single file (functions 121 Copy Names to Clipboard and 122 Full Names to Clipboard).

A new line after the path when using the copied path in the terminal executes the file, which can cause problems.

When using the file name for the rename, the new line symbol has to be removed because it is written to the filename (on internal storage) :

Code: Select all

ls '/storage/sdcard1/Download/'|grep IMG_20210806_132015.jpg|od -c
0000000    I   M   G   _   2   0   2   1   0   8   0   6   _   1   3   2
0000020    0   1   5   .   j   p   g   ?  \n
"?" a newline character in the file name
Post Reply