Author Topic: BUG - Renaming Directory or File Breaks Description / Comment  (Read 563 times)

0 Members and 1 Guest are viewing this topic.

Offline mhoney

  • Occasional poster
  • *
  • Posts: 12
    • 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
  • Insane poster
  • *****
  • Posts: 1818
    • View Profile
Re: BUG - Renaming Directory or File Breaks Description / Comment
« Reply #1 on: May 18, 2018, 03:27:11 PM »
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, 04:01:39 PM by Mars »
FRENCH MEMBER : Si vous comprenez la langue française,  n'hésitez pas à l'utiliser pour une meilleure aide de ma part

Offline rejetto

  • Administrator
  • Insane programmer
  • *
  • Posts: 12844
    • View Profile
Re: BUG - Renaming Directory or File Breaks Description / Comment
« Reply #2 on: May 22, 2018, 03:45:22 PM »
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.