KreativJos / csharpextensions

C# Extensions for Visual Studio Code
MIT License
74 stars 34 forks source link

Can modify the template suffix? #124

Open wosledon opened 1 year ago

wosledon commented 1 year ago

I mentioned an issue earlier #66 is about the case where the template folder is empty.Now I found the reason.

Since the files with the tmpl suffix resemble temporary files in Windows, they were cleaned up when I used some scripts or software to clean junk files.

I think this could be fixed by modifying the template suffix.

bard83 commented 1 year ago

It will be also interesting to know when the templates are deleted. Does it happen randomly?

wosledon commented 1 year ago

Well, when I try to use the tool to clean up junk files of C drive as well as cache files, the files with tmpl suffix are also in the cleanup items.

Like a tool named Dism++ or this script

@echo off
echo cleaing...
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo clear!

echo. & pause
bard83 commented 1 year ago

TBH I'd rather tend to say that you should open a bug on the Dism++ repo. It clearly deletes something which is not a temporary file.

wosledon commented 1 year ago

I'm guessing that at some point the tmpl suffix might be recognized as a suffix like tmp, or the tmpl suffix would have been in the cleanup list. Because every time I clean up the junk files, the template files are lost.

bard83 commented 1 year ago

You could make an easy test, just creating a couple of tmpl files in some folder (maybe on the same level of the vs code extension), run Dism++ and check whether they are delete or not.

wosledon commented 1 year ago

You don't need to use Dism++, the script I wrote above will do it😂😂

bard83 commented 1 year ago

Like a tool named Dism++ or this script

Well probably you should first clarify which one of them deletes the files... shouldn't you?

wosledon commented 1 year ago

All, but scripts are a relatively simple way to reproduce.

bard83 commented 1 year ago

The script you sent, deletes from several places. What I suggest is to isolate the instruction which deletes the template files. I cannot do by my self because I'm under linux.

wosledon commented 1 year ago

okey...

bard83 commented 9 months ago

I wanted to let you know about removing templates. It will happen and probably you won't struggle anymore. Yet is not clear whether it will be part of the 1.10 or 1.11. Stay tuned.

This extension will be now published here

PoLaKoSz commented 2 months ago

The reason this happens is that Windows has retained compatibility with file names from MS-DOS, where file names were limited to a 3-character extension.

source: https://superuser.com/a/1644933/914033

I would highly recommend rewrite your script in PowerShell and if possible and an exclusion to Dism++ to prevent deleting the extension template files.