The easiest way is to use the tests built into 'make'. See test/README for instructions. To learn the "inner-workings" of rmw, continue reading this page.
By default (specified in the config file) rmw will not perform operations on your regular Trash folder; the configuration option for that is
rmw will create that folder and your personal configuration file ($HOME/.config/rmw/config) the first time it's run.
One method of testing is to change the HOME environmental variable at run time. At the command line, use:
(use `./rmw` if the program is not yet in your PATH)
rmw would detect your home directory as your present working directory, and would create the necessary directories. Now create a blank file:
And then remove it to your temporary rmw trash folder:
HOME=$PWD rmw tempfile
tempfile would be moved to $PWD/.trash.rmw/files, and a `.trashinfo` file will be created in $PWD/.trash.rmw/info. The format of the .trashinfo file is the same that your Desktop trash uses:
[Trash Info] Path=/home/andy/src/rmw/tempfile DeletionDate=2017-11-17T13:44:04a
HOME=$PWD rmw -u
You'll see that tempfile has been restored to its original location.
The following method is a little more complex
In rmw.h, change DATA_DIR
`#define DATA_DIR "/testing/.config/testrmw"`
Then build it.
Run the rebuilt binary to create that folder. Then copy '/etc/rmwrc' (if it's not there, try /usr/local/etc/ or the rmw source directory (./etc)) into it, and rename the newly-placed 'rmwrc' to 'config'.
Add a WASTE folder to the top of 'config', such as WASTE=$HOME/testing/.local/share/Trash.test
Comment out any other WASTE folders.
`~: mkdir $HOME/testing/.local/share/Trash.test`
Copy all the files from your regular Trash into the test folder:
cp -a $HOME/.local/share/Trash/* .
Now run 'ls'. You should see 2 directories: files, info
Now 'cd' back to $HOME/testing
Create some unnecessary files.
will create 26 empty files, a-z.
will create 10 empty files, 1-10
You can now use 'rmw' on these files, or copy real files and directories into ~/testing to try it out.
Setting the RMWTRASH environmental variable at run-time to "fake-year" will write the year 1999 to the DeletionDate string in the .trashinfo file.
RMWTRASH=fake-year rmw some.txt temp.asc files.doc
Then run rmw with the purge option
Powered by jekyll