Skip to content

Commit

Permalink
Check presentation file or folder existance. (#212)
Browse files Browse the repository at this point in the history
* Add videos on README as per #188

* Fix video preview on README

* #211 Add pre-check when firing hovercraft command for existance of presentation argument.
  • Loading branch information
yeyeto2788 authored and regebro committed Jan 10, 2020
1 parent 61efb13 commit f5a9eca
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Changes
2.7beta2 (unreleased)
---------------------

- Nothing changed yet.
- Added the pre-check for file or folder existance when serving or
creating the presentation.


2.7beta1 (2019-11-06)
Expand Down
2 changes: 2 additions & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,6 @@ Other contributors (see CHANGES.txt for details):

* Dan Jacka [danjacka]

* Juan Biondi [yeyeto2788]

.. _impress.js: http://github.com/bartaz/impress.js
12 changes: 12 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,22 @@ Installation
------------

Hovercraft requires Python 3 and can be installed like any Python package.

The easiest way is to install pip_, and then run::

$ pip3 install hovercraft

* Installation on Ubuntu and Debian based computers:

.. image:: https://img.youtube.com/vi/tHSJLF9OnKQ/0.jpg
:target: https://www.youtube.com/watch?v=tHSJLF9OnKQ

* Installation on Windows:

.. image:: https://img.youtube.com/vi/I63I8Az24d8/0.jpg
:target: https://www.youtube.com/watch?v=I63I8Az24d8


Hovercraft is untested on Windows, but there is no reason it shouldn't work, at least in theory.


Expand Down
5 changes: 5 additions & 0 deletions hovercraft/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ def my_gettext(s):

def serve_presentation(args):

# Check whether the file or folder as input exists.
if not os.path.exists(os.path.abspath(args.presentation)):
print(f"File or folder '{args.presentation}' does not exists.")
exit(-1)

# XXX Bit of a hack, clean this up, I check for this twice, also in the template.
if args.template and args.template not in ("simple", "default"):
args.template = os.path.abspath(args.template)
Expand Down

0 comments on commit f5a9eca

Please sign in to comment.