|
@@ -1,13 +1,13 @@
|
|
|
package onfileindir
|
|
package onfileindir
|
|
|
|
|
|
|
|
import (
|
|
import (
|
|
|
|
|
+ "fmt"
|
|
|
"github.com/OliveTin/OliveTin/internal/acl"
|
|
"github.com/OliveTin/OliveTin/internal/acl"
|
|
|
"github.com/OliveTin/OliveTin/internal/config"
|
|
"github.com/OliveTin/OliveTin/internal/config"
|
|
|
"github.com/OliveTin/OliveTin/internal/executor"
|
|
"github.com/OliveTin/OliveTin/internal/executor"
|
|
|
"github.com/OliveTin/OliveTin/internal/filehelper"
|
|
"github.com/OliveTin/OliveTin/internal/filehelper"
|
|
|
- "path/filepath"
|
|
|
|
|
"os"
|
|
"os"
|
|
|
- "fmt"
|
|
|
|
|
|
|
+ "path/filepath"
|
|
|
)
|
|
)
|
|
|
|
|
|
|
|
func WatchFilesInDirectory(cfg *config.Config, ex *executor.Executor) {
|
|
func WatchFilesInDirectory(cfg *config.Config, ex *executor.Executor) {
|
|
@@ -30,8 +30,8 @@ func scheduleExec(action *config.Action, cfg *config.Config, ex *executor.Execut
|
|
|
args := map[string]string{
|
|
args := map[string]string{
|
|
|
"filepath": path,
|
|
"filepath": path,
|
|
|
"filename": filepath.Base(path),
|
|
"filename": filepath.Base(path),
|
|
|
- "filedir": filepath.Dir(path),
|
|
|
|
|
- "fileext": filepath.Ext(path),
|
|
|
|
|
|
|
+ "filedir": filepath.Dir(path),
|
|
|
|
|
+ "fileext": filepath.Ext(path),
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if stat, err := os.Stat(path); err == nil {
|
|
if stat, err := os.Stat(path); err == nil {
|
|
@@ -47,7 +47,7 @@ func scheduleExec(action *config.Action, cfg *config.Config, ex *executor.Execut
|
|
|
ActionTitle: action.Title,
|
|
ActionTitle: action.Title,
|
|
|
Cfg: cfg,
|
|
Cfg: cfg,
|
|
|
Tags: []string{"fileindir"},
|
|
Tags: []string{"fileindir"},
|
|
|
- Arguments: args,
|
|
|
|
|
|
|
+ Arguments: args,
|
|
|
AuthenticatedUser: &acl.AuthenticatedUser{
|
|
AuthenticatedUser: &acl.AuthenticatedUser{
|
|
|
Username: "fileindir",
|
|
Username: "fileindir",
|
|
|
},
|
|
},
|