Fix file path not being store properly
This commit is contained in:
parent
d162919b3d
commit
1580865b56
10
tag.sh
10
tag.sh
|
@ -150,8 +150,8 @@ add_path() {
|
|||
COLUMN="filename,path"
|
||||
FILES=()
|
||||
for FILE in "$@"; do
|
||||
FILENAME=$(basename "$FILE")
|
||||
FILEPATH=$(dirname "$FILE")
|
||||
local FILENAME=$(basename "$FILE")
|
||||
local FILEPATH=$(realpath $(dirname "$FILE"))
|
||||
file_exists_in_db "$FILE" && fail "File '$FILE' already exists in database."
|
||||
FILES+=("'$FILENAME'")
|
||||
FILES+=("'$FILEPATH'")
|
||||
|
@ -187,9 +187,9 @@ tag_exists_in_db() {
|
|||
|
||||
file_exists_in_db() {
|
||||
# $FILENAME
|
||||
FILENAME=$(basename "${1:-}")
|
||||
FILEPATH=$(dirname "${1:-}")
|
||||
RESULT=$(sqlite_query "SELECT id FROM files WHERE filename = '$FILENAME' AND path = '$FILEPATH'")
|
||||
local FILENAME=$(basename "${1:-}")
|
||||
local FILEPATH=$(dirname "${1:-}")
|
||||
local RESULT=$(sqlite_query "SELECT id FROM files WHERE filename = '$FILENAME' AND path = '$FILEPATH'")
|
||||
if [[ -z "$RESULT" ]]; then
|
||||
return 1
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue