ransome1 / sleek

todo.txt manager for Linux, Windows and MacOS, free and open-source (FOSS)
https://github.com/ransome1/sleek/wiki
MIT License
1.35k stars 105 forks source link

Sleek says it archives to done.txt, but actually archives to todo_done.txt #378

Closed dragos240 closed 1 year ago

dragos240 commented 2 years ago

Is it an actual bug? Yes

Did you check if the bug has already been reported? Yes

Describe the bug Sleek says it archives to done.txt, but actually archives to todo_done.txt

To Reproduce Steps to reproduce the behavior:

  1. Create a task
  2. Complete the task
  3. Archive the task, it will say it will write the task in done.txt
  4. See that it in fact writes to todo_done.txt

Do you see any error entries in sleeks developer tools? No errors as far as I can see

Expected behavior done.txt was written to instead of todo_done.txt

Screenshots Not applicable.

Desktop (please complete the following information):

ransome1 commented 2 years ago

@dragos240 In fact it archives to NAMEOFYOURTODOFILE_done.txt, so I will need to add some dynamic wording here. Thanks for pointing it out.

nogasgofast commented 2 years ago

I ran into this issue as well.

Personally I use done.txt, so it would really be great if we could change this as a setting. I expect there are a number of people that use todo.txt because there are a lot of options when it comes to integrating it on different platforms. But if this is a static setting it sort of hamstrings that compatibility. As done files are not really a part of the spec.

But it's not really a show stopper for me. I use sleek because it's text is slightly bigger and easier to read.

durgaswaroop commented 1 year ago

@ransome1, In my case, no file is created in the directory. It says it moves to done.txt. It removes all the completed tasks from the todo.txt file, but no file is created anywhere. I searched the entire file system, but don't see any new .txt files created. Right now, it seems like those tasks are just gone. The current behavior seems to be delete rather than archive. Is there a way to figure out where they got stored, if at all?

I am on Windows 10 too using Sleek 1.2.9

ransome1 commented 1 year ago

I can't confirm this. I downloaded 1.2.9 from GitHub and the done.txt file being created in the same directory in which the actual todo file is located.

Can you please check the developer console, if there are any errors related to this? Press the alt key once and the sun menu will appear. In there click on About and Toggle developer tools.

durgaswaroop commented 1 year ago

Looked at the developer console, but I do not see any errors in the console tab. But there is no log mentioning that a new file is being created, though.

I see that when I hit A for it to archive the todos, it says

Success: Completed todos appended to: <HOME>\personal\todo_done.txt\todo.txt

But that path does not exist. The path of my todo.txt file is <HOME>\personal\todo.txt\todo.txt. Based on that the path to the new file should ideally be <HOME>\personal\todo.txt\done.txt.

It is looking at the wrong folder and also seems to have the wrong file name. And it is giving a Success message even when it seems to be failing.

image

ransome1 commented 1 year ago

I assume the issue is the name of your folder, which contains a period. Maybe this breaks something on windows. I'll look into it tomorrow.

Can you please try the rename the directory and remove the period character. I'm wondering if the issue would still occur.

durgaswaroop commented 1 year ago

Tried without the period in the name. It is working now!

Looks like the code is trying to just replace the first todo.txt in the path to todo_done.txt and writes to it. In this case, it happened to be the folder name, which is why that didn't work. Although I wonder why it didn't throw any error for that.

Is there any way to get the completed to-dos that failed to get archived?

durgaswaroop commented 1 year ago

Looking at the code, I see this line is the cause. It is replacing the name in the entire file path string instead of doing just the filename. https://github.com/ransome1/sleek/blob/aad500c0d727294f2be0579b2a76e27394c9e291/src/js/helper.mjs#L169

I can put in a PR for this tomorrow if you'd like.

durgaswaroop commented 1 year ago

I went ahead and created the PR. You can take a look - https://github.com/ransome1/sleek/pull/446

ransome1 commented 1 year ago

@durgaswaroop amazing, thank you so much :) I'll take a look at it as soon as I am on a computer!

github-actions[bot] commented 1 year ago

This is an automated response. We acknowledge your report, and we appreciate your engagement. However, as there has been no recent activity in this thread, it has been marked as stale. If you have any further feedback or if the matter is still relevant, please do not hesitate to respond. Otherwise, this thread will be automatically closed in 15 days from now.