Register mimetype for *.code-workspace

This commit is contained in:
Luqman Aden
2020-04-19 04:57:06 -07:00
parent a84d194763
commit 828389d890
6 changed files with 39 additions and 4 deletions

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-@@NAME@@-workspace">
<comment>@@NAME_LONG@@ Workspace</comment>
<glob pattern="*.code-workspace"/>
</mime-type>
</mime-info>

View File

@@ -8,7 +8,7 @@ Type=Application
StartupNotify=false
StartupWMClass=@@NAME_SHORT@@
Categories=Utility;TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;
MimeType=text/plain;inode/directory;application/x-@@NAME@@-workspace;
Actions=new-empty-window;
Keywords=vscode;

View File

@@ -18,6 +18,11 @@ if hash desktop-file-install 2>/dev/null; then
desktop-file-install /usr/share/applications/@@NAME@@-url-handler.desktop
fi
# Update mimetype database to pickup workspace mimetype
if hash update-mime-database 2>/dev/null; then
update-mime-database /usr/share/mime
fi
if [ "@@NAME@@" != "code-oss" ]; then
# Remove the legacy bin command if this is the stable build
if [ "@@NAME@@" = "code" ]; then

View File

@@ -3,4 +3,9 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
rm -f /usr/bin/@@NAME@@
rm -f /usr/bin/@@NAME@@
# Update mimetype database for removed workspace mimetype
if hash update-mime-database 2>/dev/null; then
update-mime-database /usr/share/mime
fi

View File

@@ -23,6 +23,7 @@ mkdir -p %{buildroot}/usr/share/zsh/site-functions
cp -r usr/share/@@NAME@@/* %{buildroot}/usr/share/@@NAME@@
cp -r usr/share/applications/@@NAME@@.desktop %{buildroot}/usr/share/applications
cp -r usr/share/applications/@@NAME@@-url-handler.desktop %{buildroot}/usr/share/applications
cp -r usr/share/mime/packages/@@NAME@@-workspace.xml %{buildroot}/usr/share/mime/packages/@@NAME-workspace.xml
cp -r usr/share/pixmaps/@@ICON@@.png %{buildroot}/usr/share/pixmaps
cp usr/share/bash-completion/completions/@@NAME@@ %{buildroot}/usr/share/bash-completion/completions/@@NAME@@
cp usr/share/zsh/site-functions/_@@NAME@@ %{buildroot}/usr/share/zsh/site-functions/_@@NAME@@
@@ -46,17 +47,24 @@ ln -sf /usr/share/@@NAME@@/bin/@@NAME@@ %{_bindir}/@@NAME@@
# fi
#fi
# Update mimetype database to pickup workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%postun
if [ $1 = 0 ]; then
rm -f /usr/bin/@@NAME@@
fi
# Update mimetype database for removed workspace mimetype
update-mime-database /usr/share/mime &> /dev/null || :
%files
%defattr(-,root,root)
/usr/share/@@NAME@@/
/usr/share/applications/@@NAME@@.desktop
/usr/share/applications/@@NAME@@-url-handler.desktop
/usr/share/mime/packages/@@NAME-workspace.xml
/usr/share/pixmaps/@@ICON@@.png
/usr/share/bash-completion/completions/@@NAME@@
/usr/share/zsh/site-functions/_@@NAME@@