Blender  V3.3
GHOST_ISystemPaths.cpp
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
12 #include "GHOST_ISystemPaths.h"
13 
14 #ifdef WIN32
15 # include "GHOST_SystemPathsWin32.h"
16 #else
17 # ifdef __APPLE__
18 # include "GHOST_SystemPathsCocoa.h"
19 # else
20 # include "GHOST_SystemPathsUnix.h"
21 # endif
22 #endif
23 
24 GHOST_ISystemPaths *GHOST_ISystemPaths::m_systemPaths = nullptr;
25 
27 {
28  GHOST_TSuccess success;
29  if (!m_systemPaths) {
30 #ifdef WIN32
31  m_systemPaths = new GHOST_SystemPathsWin32();
32 #else
33 # ifdef __APPLE__
34  m_systemPaths = new GHOST_SystemPathsCocoa();
35 # else
36  m_systemPaths = new GHOST_SystemPathsUnix();
37 # endif
38 #endif
39  success = m_systemPaths != nullptr ? GHOST_kSuccess : GHOST_kFailure;
40  }
41  else {
42  success = GHOST_kFailure;
43  }
44  return success;
45 }
46 
48 {
50  if (m_systemPaths) {
51  delete m_systemPaths;
52  m_systemPaths = nullptr;
53  }
54  else {
55  success = GHOST_kFailure;
56  }
57  return success;
58 }
59 
61 {
62  if (!m_systemPaths) {
63  create();
64  }
65  return m_systemPaths;
66 }
GHOST_TSuccess
Definition: GHOST_Types.h:74
@ GHOST_kFailure
Definition: GHOST_Types.h:74
@ GHOST_kSuccess
Definition: GHOST_Types.h:74
static GHOST_TSuccess create()
static GHOST_TSuccess dispose()
static GHOST_ISystemPaths * get()