Re: [PATCH 4/4] kernel-shark: Configuration file directory to be created by the executable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxx>
> Signed-off-by: Yordan Karadzhov <ykaradzhov@xxxxxxxxxx>
> ---
>  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



[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux