Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 'Command' WorkingDirectory #42

Open
MusicMan74 opened this issue Apr 17, 2024 · 4 comments
Open

Add support for 'Command' WorkingDirectory #42

MusicMan74 opened this issue Apr 17, 2024 · 4 comments

Comments

@MusicMan74
Copy link

MusicMan74 commented Apr 17, 2024

Hello and thanks for FileWatcher!

I am currently using FW to monitor file changes and run an EXE on a change.

My issue is that the command line executable I'm running uses the "WorkingDirectory".
I can work around this limitation if I launch FW.exe from the desired "WorkingDirectory", i.e.

C:\Users\User\Desktop\Repo1>c:\Portable\FileWatcher\fw.exe

However, if I need to monitor files from two different folders (i.e. define two configuration xml nodes), I can't run FW from both folder locations :)
[Unless I run two instances of FW?]

Therefore, does it make sense/possible to add a 'WorkingDirectory' XML 'Command' sub-node in the configuration file which would be applied when the EXE is run?

i.e.

`

<watch>
    <!--
        The path of the Mercurial repository I'm monitoring:
         -->
	<path>C:\Users\User\Desktop\Repo1</path>
	<commands>
		<command>
			<triggers>
				<trigger>Change</trigger>
			</triggers>                      
			<workingdirectory>C:\Users\User\Desktop\Repo1</workingdirectory>
			<path>C:\Program Files\TortoiseHg\thg.exe</path>
			<arguments>commit "[exactpath]"</arguments>
		</command>
	</commands>                   
</watch>
<watch>
    <!--
        The path of the Mercurial repository I'm monitoring:
    -->
	<path>C:\Users\User\Desktop\Repo2</path>
	<commands>
		<command>
			<triggers>
				<trigger>Change</trigger>
			</triggers>
			<workingdirectory>C:\Users\User\Desktop\Repo2</workingdirectory>
			<path>C:\Program Files\TortoiseHg\thg.exe</path>
			<arguments>commit "[exactpath]"</arguments>
		</command>
	</commands>                   
</watch>
`

Thanks in advance for your time :)

@TechieGuy12
Copy link
Owner

I have added the working directory tag to the 1.5.2 beta release: https://github.com/TechieGuy12/FileWatcher/releases/tag/1.5.2-beta.1.

Check to see if it works for you?

@MusicMan74
Copy link
Author

MusicMan74 commented Apr 22, 2024

Hi,

Thanks for responding.
I tried the new binary (SHA-1 28eee7595623815bcf3004ebbcae3bd05c7dfe66) and updated my config file but the tag does not seem to take effect...

<watches> <watch> <path>C:\Users\Greg\Desktop\Repo2</path> <commands> <command> <triggers> <trigger>Change</trigger> </triggers> <workingdirectory>C:\Users\Greg\Desktop\Repo2</workingdirectory> <path>C:\Program Files\TortoiseHg\thg.exe</path> <arguments>commit "[exactpath]"</arguments> </command> </commands> </watch> </watches>

I tried with and without trailing backslash, ( i.e. Repo2\ ) but no luck
Is my syntax incorrect?

I can't see what you changed since there is nothing to compare in commit 3ab7185;
also the source code zips in the 1.5.2-Beta1 assets are identical to the release from 2023.12.29...

Could you add logging to confirm WorkingDirectory is being read correctly and/or actually used?

Again, thanks for your time :)

@TechieGuy12
Copy link
Owner

I forgot to mention the tag in the XML file is workingDirectory with a capital 'D'.

The commit for the beta is in the develop branch.

@MusicMan74
Copy link
Author

Working as expected with the right syntax :)
workingDirectory

I presumed all lower case based on 1) my original example config and 2) all lower case used for other config multiword tags, i.e. waitbefore

Again, thanks for fix :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants