summaryrefslogtreecommitdiff
path: root/notepadpp/debian/bin
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-12-29 13:06:46 +0000
committerB Stack <bgstack15@gmail.com>2019-12-29 13:06:46 +0000
commit5dd2ccf0878b4d9939999cd7904e2361522c73d9 (patch)
tree0dd4e58c857c63e2f0e0b250ed66028effb35fc9 /notepadpp/debian/bin
parentMerge branch 'freefilesync-bump' into 'master' (diff)
parentAdd notepad++ as notepadpp (diff)
downloadstackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.tar.gz
stackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.tar.bz2
stackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.zip
Merge branch 'notepadpp-bump' into 'master'
Add notepad++ as notepadpp See merge request bgstack15/stackrpms!112
Diffstat (limited to 'notepadpp/debian/bin')
-rwxr-xr-xnotepadpp/debian/bin/notepadpp-common81
1 files changed, 81 insertions, 0 deletions
diff --git a/notepadpp/debian/bin/notepadpp-common b/notepadpp/debian/bin/notepadpp-common
new file mode 100755
index 0000000..7c1c2f8
--- /dev/null
+++ b/notepadpp/debian/bin/notepadpp-common
@@ -0,0 +1,81 @@
+#!/bin/sh
+# File: notepadpp-common
+# Locations: /usr/bin
+# Author: bgstack15@gmail.com
+# Startdate: 2019-12-27
+# Title: Common Elements for Wrapper script for passing files to notepadpp
+# Purpose: Converts file paths to a wine format
+# History:
+# Usage:
+# called from notepadpp (which is symlink to notepadpp32 or notepadpp64)
+# Do not use this by itself.
+# Reference:
+# irfanview-common
+# Improve:
+
+if ! test "${NPP_VALID_CALL:-nothing}" = "do_not_set_this_manually" ;
+then
+ printf "%s\n" "Do not call this script by itself! Use \"notepadpp\". Aborted."
+ false
+else
+
+NPP_VERSION="2019-12-27a"
+
+# Define functions
+expandword() {
+ # call: expandword "${word}"
+ # if file, add it
+ # if directory, expand it
+ # if tarball, extract it and operate on the directory like normal
+ local _word="$( echo "${@}" | sed -e 'sF\/\/F\/Fg;' )"
+ if test -d "${_word}";
+ then
+ # loop through all files in the directory
+ for _newword in "${_word}"/*;
+ do
+ expandword "${_newword}";
+ done
+ elif test -f "${_word}";
+ then
+ # file exists so check if tarball
+ case "${_word}" in
+ *)
+ # assume it is readable and add it to list of files to open
+ echo "File ${_word}"
+ thisfile="$( getwinepath "${_word}" )"
+ wineappfiles="${wineappfiles} ${thisfile}"
+ ;;
+ esac
+ fi
+}
+
+getwinepath() {
+ # call: getwinepath "$foo"
+ wine winepath.exe -w "${@}"
+}
+
+# Define variables
+alltempdirs=""
+
+# prepare files
+wineappargs=
+wineappfiles=
+
+for word in "${@}";
+do
+ expandword "${word}"
+done
+wineappfiles="${wineappfiles## }"
+
+# run wine
+cd $WINEPREFIX
+printf wine "${NPP_EXEC_PATH}" ${wineappargs} ${wineappfiles}
+wine "${NPP_EXEC_PATH}" ${wineappargs} ${wineappfiles} &
+
+wait %1
+for thistempdir in ${alltempdirs};
+do
+ rm -rf "${thistempdir}"
+done
+
+fi
bgstack15