rejetto forum

BUG - Renaming Directory or File Breaks Description / Comment

mhoney · 3 · 3429

0 Members and 1 Guest are viewing this topic.

Offline mhoney

  • Occasional poster
  • *
    • Posts: 16
    • View Profile
Like the subject says, if you rename a file or directory that has an existing comment you break the link and that info disappears.  It's still in the text file but doesn't get updated.


Offline Mars

  • Operator
  • Tireless poster
  • *****
    • Posts: 2059
    • View Profile
the comments have never been fully managed, there are three types of recordings, but the most used is the recording in a file named hfs.comments.txt for the real directories

it is easy to manage comments when renaming file by using this modified section in the template
Code: [Select]
[ajax.rename|no log]
{.check session.}
{.break|if={.not|{.can rename.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|from.}.}|result=forbidden.}
{.break|if={.is file protected|{.postvar|to.}.}|result=forbidden.}
{.set|x|{.force ansi|%folder%{.postvar|from.}.}.}
{.set|y|{.force ansi|%folder%{.postvar|to.}.}.}
{.break|if={.not|{.exists|{.^x.}.}.}|result=not found.}
{.break|if={.exists|{.^y.}.}|result=exists.}
{.comment| "from here we manage the comment assignment using the dedicated macros" .}
{.set|comment| {.get item|{.^x.}|comment.} .}
{.comment| "it is necessary to remove the comment from the source file before attempting to rename it" .}
{.set item|{.^x.}|comment=.}
{.set|hasrenamed|{.length|{.rename|{.^x.}|{.^y.}.}.}
{.comment| "depending on whether the file has been renamed or not, the comment is attributed to the resulting name" .}
{.set item|{.if|{.^hasrenamed.}|{:{.^y.}:}|{:{.^x.}:}/if.}|comment={.^comment.}.}
{.set|comment|.}
{.break|if={.not|{.^hasrenamed.}.}|result=failed.}
{.add to log|User %user% renamed "{.^x.}" to "{.^y.}".}
{.pipe|ok.}
« Last Edit: May 22, 2018, 10:01:39 PM by Mars »


Offline rejetto

  • Administrator
  • Tireless poster
  • *****
    • Posts: 13510
    • View Profile
if you rename the file by using HFS itself, and you are using the latest version of default template, the comment is expected to be updated.

If you press F6 you should see this:
Welcome! This is the default template for HFS 2.3
template revision TR2.


if it doesn't say TR2 then your template is outdated.