Replace realpath with readlink -f

This commit is contained in:
Lukáš Kucharczyk 2022-11-19 00:08:23 +01:00
parent 1458620bee
commit 27f6db5410
Signed by: lukas
SSH Key Fingerprint: SHA256:vMuSwvwAvcT6htVAioMP7rzzwMQNi3roESyhv+nAxeg
1 changed files with 3 additions and 3 deletions

6
tag.sh
View File

@ -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