Message ID | 20190404145603.13592-5-ykaradzhov@vmware.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Various modifications and fixes toward KS 1.0 | expand |
On Thu, Apr 04, 2019 at 05:56:03PM +0300, Yordan Karadzhov wrote: > The build process should not make the directory that will contain > KernelShark configuration files. This directory should be made by > the application itself. > > Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> > Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> > --- > kernel-shark/CMakeLists.txt | 2 -- > kernel-shark/src/KsMainWindow.cpp | 3 +++ > 2 files changed, 3 insertions(+), 2 deletions(-) > > diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt > index 14d73f5..c6a4abf 100644 > --- a/kernel-shark/CMakeLists.txt > +++ b/kernel-shark/CMakeLists.txt > @@ -17,8 +17,6 @@ set(KS_DIR ${CMAKE_SOURCE_DIR}) > set(_KS_CACHE_DIR "$ENV{HOME}/.cache/kernelshark" > CACHE STRING "Directory for cached configuration files.") > > -file(MAKE_DIRECTORY ${_KS_CACHE_DIR}) > - > include(${KS_DIR}/build/FindTraceCmd.cmake) > include(${KS_DIR}/build/FindJSONC.cmake) > > diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp > index 39b06d6..898e598 100644 > --- a/kernel-shark/src/KsMainWindow.cpp > +++ b/kernel-shark/src/KsMainWindow.cpp > @@ -127,6 +127,9 @@ KsMainWindow::KsMainWindow(QWidget *parent) > this, &KsMainWindow::_deselectB); > > _resizeEmpty(); > + > + if (!QDir(KS_CACHE_DIR).exists()) > + QDir().mkdir(KS_CACHE_DIR); > } This should be QtDir().mkpath() since KS_CACHE_DIR is configurable and can be of the form '/foo/bar/baz'. Also this code doesn't handle the case when the cache dir is overriden by an environment variable. I think it's better to move this to where we save the session rather then here. -- Slavi
diff --git a/kernel-shark/CMakeLists.txt b/kernel-shark/CMakeLists.txt index 14d73f5..c6a4abf 100644 --- a/kernel-shark/CMakeLists.txt +++ b/kernel-shark/CMakeLists.txt @@ -17,8 +17,6 @@ set(KS_DIR ${CMAKE_SOURCE_DIR}) set(_KS_CACHE_DIR "$ENV{HOME}/.cache/kernelshark" CACHE STRING "Directory for cached configuration files.") -file(MAKE_DIRECTORY ${_KS_CACHE_DIR}) - include(${KS_DIR}/build/FindTraceCmd.cmake) include(${KS_DIR}/build/FindJSONC.cmake) diff --git a/kernel-shark/src/KsMainWindow.cpp b/kernel-shark/src/KsMainWindow.cpp index 39b06d6..898e598 100644 --- a/kernel-shark/src/KsMainWindow.cpp +++ b/kernel-shark/src/KsMainWindow.cpp @@ -127,6 +127,9 @@ KsMainWindow::KsMainWindow(QWidget *parent) this, &KsMainWindow::_deselectB); _resizeEmpty(); + + if (!QDir(KS_CACHE_DIR).exists()) + QDir().mkdir(KS_CACHE_DIR); } /** Destroy KernelShark Main window. */
The build process should not make the directory that will contain KernelShark configuration files. This directory should be made by the application itself. Suggested-by: Steven Rostedt (VMware) <rostedt@goodmis.org> Signed-off-by: Yordan Karadzhov <ykaradzhov@vmware.com> --- kernel-shark/CMakeLists.txt | 2 -- kernel-shark/src/KsMainWindow.cpp | 3 +++ 2 files changed, 3 insertions(+), 2 deletions(-)