From 7e4cc68492db68bc0cdbce4db269ef9383ff99e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 3 Mar 2015 17:03:32 +0100 Subject: [PATCH] Fixed SD handling of virtual printer --- src/octoprint/util/virtual.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/octoprint/util/virtual.py b/src/octoprint/util/virtual.py index 90f871c9..51bb253d 100644 --- a/src/octoprint/util/virtual.py +++ b/src/octoprint/util/virtual.py @@ -263,6 +263,8 @@ class VirtualPrinter(): self.outgoing.put("End file list") def _selectSdFile(self, filename): + if filename.startswith("/"): + filename = filename[1:] file = os.path.join(self._virtualSd, filename).lower() if not os.path.exists(file) or not os.path.isfile(file): self.outgoing.put("open failed, File: %s." % filename) @@ -448,6 +450,8 @@ class VirtualPrinter(): pass def _writeSdFile(self, filename): + if filename.startswith("/"): + filename = filename[1:] file = os.path.join(self._virtualSd, filename).lower() if os.path.exists(file): if os.path.isfile(file): @@ -507,6 +511,8 @@ class VirtualPrinter(): time.sleep(delay) def _deleteSdFile(self, filename): + if filename.startswith("/"): + filename = filename[1:] f = os.path.join(self._virtualSd, filename) if os.path.exists(f) and os.path.isfile(f): os.remove(f)