TechieGuy12 / FileWatcher

A file and folder monitor that can send notifications, perform actions, or execute a command when a file or folder is changed.
MIT License
106 stars 27 forks source link

Issue if folder has Slovenian character #24

Closed kacnje closed 2 years ago

kacnje commented 2 years ago

If in section in XML I use k:\zacasno, it works. If I change it to k:\začasno, I get an error: The configuration file could not be read. Reason: There is an error in XML document (3, 20).

Is this a bug?

TechieGuy12 commented 2 years ago

It is an issue with character with the accent. I'll have to test on my side to determine the fix.

kacnje commented 2 years ago

Tnx. We will wait to see results.

TechieGuy12 commented 2 years ago

I have created a config XML file with k:\začasno, but am unable to reproduce the error. Can you send your XML file?

kacnje commented 2 years ago

Of couse:

<watches>
    <watch>
            <path>K:\Začasno</path>
        <commands>
            <command>
                <triggers>
            <trigger>Create</trigger>
            <trigger>Change</trigger>
            <trigger>Rename</trigger>
            <trigger>Delete</trigger>
                </triggers>            
        <path>C:\Program Files\Amebis Besana\BesPre.exe</path>
            </command>
        </commands>    
    </watch>
</watches>

Here is an error: The configuration file could not be read. Reason: There is an error in XML document (3, 20).

TechieGuy12 commented 2 years ago

I tried the XML, and still I can't reproduce the error. What encoding are you using for the XML file - UTF-8?

kacnje commented 2 years ago

Text encoding was "windows-1250". I saved the XML file into "UTF-8" encoding and it worked. After celebrating moments, I changed the line: <path>C:\Program Files\Amebis Besana\BesPre.exe</path> to <path>msg /server:comp1 john Notification</path>

And now I get: ERROR The command 'msg /server:comp1 john Notification' was not found. Command was not run. Note: comp1 and john are changed here to protect privacy.

If I run the same command in CMD prompt, it works. Could be something wrong with the slash character when using UTF-8 encoding. It worked before. MSG is a system command and it is in path.

TechieGuy12 commented 2 years ago

For commands, there are separate tags for the executable path and the arguments. In your case, it would be something like:

<command>
    <triggers>
        <trigger>Create</trigger>
        <trigger>Change</trigger>
        <trigger>Rename</trigger>
        <trigger>Delete</trigger>
    </triggers>                      
    <path>msg</path>                 
    <arguments>/server:comp1 john Notification</arguments>
</command>

You may also want to use the full path to the msg executable, as well.

kacnje commented 2 years ago

Tnx. I read the Wiki site, but I simply forgot.

TechieGuy12 commented 2 years ago

The issue has been resolved. I'll close this issue, but if needed, you can open another issue.