Replace realpath with readlink -f
This commit is contained in:
parent
1458620bee
commit
27f6db5410
6
tag.sh
6
tag.sh
|
@ -57,7 +57,7 @@ SCRIPT_NAME=$(basename "$0")
|
|||
|
||||
|
||||
DB_FILE="${PWD}/tags.db"
|
||||
[ "${1:-}" = "--db" ] && DB_FILE=$(realpath "${2/#~/$HOME}") && shift 2
|
||||
[ "${1:-}" = "--db" ] && DB_FILE=$(readlink -f "${2/#~/$HOME}") && shift 2
|
||||
|
||||
|
||||
DB_SCHEMA="${SCRIPT_DIR}/database.sql"
|
||||
|
@ -189,7 +189,7 @@ add_path() {
|
|||
for FILE in "$@"; do
|
||||
[ ! -f "$FILE" ] && fail "File '$FILE' does not exist in the specified path."
|
||||
local FILENAME=$(basename "$FILE")
|
||||
local FILEPATH=$(realpath "$(dirname "$FILE")")
|
||||
local FILEPATH=$(readlink -f "$(dirname "$FILE")")
|
||||
file_exists_in_db "$FILE" && fail "File '$FILE' already exists in database."
|
||||
FILES+=("\"$FILENAME\"")
|
||||
FILES+=("\"$FILEPATH\"")
|
||||
|
@ -237,7 +237,7 @@ file_exists_in_db() {
|
|||
id_by_filename() {
|
||||
# FILENAME
|
||||
local FILENAME=$(basename "${1:-}")
|
||||
local FILEPATH=$(realpath "$(dirname "${1:-}")")
|
||||
local FILEPATH=$(readlink -f "$(dirname "${1:-}")")
|
||||
local RESULT=0
|
||||
RESULT=$(sqlite_query "SELECT id FROM files WHERE filename = \"$FILENAME\" AND path = \"$FILEPATH\"")
|
||||
echo $RESULT
|
||||
|
|
Loading…
Reference in New Issue