summarylogtreecommitdiffstats
path: root/notepadpp
blob: 35d53c86d949ecae89165bc163f64b0984ebf1df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env sh

app_name='notepadpp'
app_ver='SED_APPVER'

pkgdir="/usr/share/${app_name}"
localdir="${HOME}/.local/share/${app_name}"
verfile="${localdir}/${app_name}.ver"

unset WINEPREFIX

if [ ! "${verfile}" ]; then
    mkdir -p "${localdir}"
    touch "${verfile}"
fi

if [ ! "$(cat "${verfile}")" = "${app_ver}" ]; then
    # Delete broken symlinks and empty dirs
    find "${localdir}" -xtype l -delete
    find "${localdir}" -type d -empty -delete

    # Copy if file does not exists
    [ -e "${localdir}/contextMenu.xml" ] || 
        cp "${pkgdir}/contextMenu.xml"   "${localdir}/contextMenu.xml"

    [ -e "${localdir}/doLocalConf.xml" ] || 
        cp "${pkgdir}/doLocalConf.xml"   "${localdir}/doLocalConf.xml"

    [ -e "${localdir}/functionList.xml" ] || 
        cp "${pkgdir}/functionList.xml"  "${localdir}/functionList.xml"

    [ -e "${localdir}/langs.model.xml" ] || 
        cp "${pkgdir}/langs.model.xml"   "${localdir}/langs.model.xml"

    [ -e "${localdir}/shortcuts.xml" ] || 
        cp "${pkgdir}/shortcuts.xml"     "${localdir}/shortcuts.xml"

    [ -e "${localdir}/stylers.model.xml" ] || 
        cp "${pkgdir}/stylers.model.xml" "${localdir}/stylers.model.xml"

    ln -s "${pkgdir}/notepad++.exe" "${localdir}/notepadpp"
    ln -s "${pkgdir}/SciLexer.dll"  "${localdir}/SciLexer.dll"
    ln -s "${pkgdir}/change.log"    "${localdir}/change.log"
    ln -s "${pkgdir}/readme.txt"    "${localdir}/readme.txt"

    cp -rs "${pkgdir}/autoCompletion"  "${localdir}"
    cp -rs "${pkgdir}/localization"    "${localdir}"
    cp -rs "${pkgdir}/plugins"         "${localdir}"
    cp -rs "${pkgdir}/themes"          "${localdir}"
    cp -rs "${pkgdir}/userDefineLangs" "${localdir}"

    echo "${app_ver}" > "${verfile}"
fi

WINEDEBUG=-all wine "${localdir}/${app_name}" "$@"