From facbe0c7517eb124b670df56e36e0f6df8396959 Mon Sep 17 00:00:00 2001
From: Gopi Krishna Nedanuri <gnedanur@codeaurora.org>
Date: Tue, 6 Sep 2016 11:31:44 +0530
Subject: [PATCH] ldrp_v2: Create folder before creating a file

   File creation is failing in some filers if it is created
in a non-existing folder.

Change-Id: Ieaacc3f1992b38683c52df6225727ab88944d65a
---
 linux-ramdump-parser-v2/ramdump.py | 3 +++
 1 file changed, 3 insertions(+)
 mode change 100644 => 100755 linux-ramdump-parser-v2/ramdump.py

diff --git a/linux-ramdump-parser-v2/ramdump.py b/linux-ramdump-parser-v2/ramdump.py
old mode 100644
new mode 100755
index e385f85..5089bde
--- a/linux-ramdump-parser-v2/ramdump.py
+++ b/linux-ramdump-parser-v2/ramdump.py
@@ -676,6 +676,9 @@ class RamDump():
         file_path = os.path.join(self.outdir, file_name)
         f = None
         try:
+            dir_path = os.path.dirname(file_path)
+            if not os.path.exists(dir_path) and 'w' in mode:
+                os.makedirs(dir_path)
             f = open(file_path, mode)
         except:
             print_out_str('Could not open path {0}'.format(file_path))
-- 
GitLab