Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>2010-02-16 01:50:53 +0300
committerGuillermo S. Romero <gsr.b3d@infernal-iceberg.com>2010-02-16 01:50:53 +0300
commit80bb824929775658bb937665318ae6981642dd6f (patch)
tree91e8c1f02ecef5eea844de22c4b4f7c0531c55d4 /intern/ghost
parent88a2f63c1efe0966f42943e74893e06361184795 (diff)
System dependant functions (skeletons) to retrieve user and system base dirs.
Thus #defines in BLI_bfile.c can be dropped, as suggested by Damien Plisson. Feel free to fill in the non Unix ones. For extra info see: http://wiki.blender.org/index.php/BlenderDev/Blender2.5/ResourceFilePaths http://wiki.blender.org/index.php/BlenderDev/Blender2.5/EnvironmentVariables
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/GHOST_C-api.h15
-rw-r--r--intern/ghost/GHOST_ISystem.h18
-rw-r--r--intern/ghost/intern/GHOST_C-api.cpp11
-rw-r--r--intern/ghost/intern/GHOST_System.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.cpp9
-rw-r--r--intern/ghost/intern/GHOST_SystemCarbon.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.h14
-rw-r--r--intern/ghost/intern/GHOST_SystemCocoa.mm10
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.cpp9
-rw-r--r--intern/ghost/intern/GHOST_SystemWin32.h15
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.cpp19
-rw-r--r--intern/ghost/intern/GHOST_SystemX11.h14
12 files changed, 162 insertions, 0 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h
index 8e254ce9c32..75a055075bc 100644
--- a/intern/ghost/GHOST_C-api.h
+++ b/intern/ghost/GHOST_C-api.h
@@ -819,6 +819,21 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection);
*/
extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection);
+/**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+extern GHOST_TUns8* GHOST_getSystemDir();
+
+/**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+extern GHOST_TUns8* GHOST_getUserDir();
+
+
#ifdef __cplusplus
}
#endif
diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h
index 8e9ac2b51ff..5e0c7f41ab8 100644
--- a/intern/ghost/GHOST_ISystem.h
+++ b/intern/ghost/GHOST_ISystem.h
@@ -371,6 +371,24 @@ public:
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
+ /***************************************************************************************
+ ** Determine special paths.
+ ***************************************************************************************/
+
+ /**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ virtual GHOST_TUns8* getSystemDir() const = 0;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ virtual GHOST_TUns8* getUserDir() const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp
index 6a9c59bc897..fd06d7620ab 100644
--- a/intern/ghost/intern/GHOST_C-api.cpp
+++ b/intern/ghost/intern/GHOST_C-api.cpp
@@ -855,3 +855,14 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection)
system->putClipboard(buffer, selection);
}
+GHOST_TUns8* GHOST_getSystemDir()
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system->getSystemDir();
+}
+
+GHOST_TUns8* GHOST_getUserDir()
+{
+ GHOST_ISystem* system = GHOST_ISystem::getSystem();
+ return system->getUserDir();
+}
diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h
index 2b45bfb86cf..59f933ea865 100644
--- a/intern/ghost/intern/GHOST_System.h
+++ b/intern/ghost/intern/GHOST_System.h
@@ -297,6 +297,20 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0;
+ /**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ virtual GHOST_TUns8* getSystemDir() const = 0;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ virtual GHOST_TUns8* getUserDir() const = 0;
+
protected:
/**
* Initialize the system.
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp
index b2ca5a915a9..763cc9edde3 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.cpp
+++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp
@@ -1215,3 +1215,12 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
+GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
+{
+
+}
+
+GHOST_TUns8* GHOST_SystemX11::getUserDir() const
+{
+
+}
diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h
index 9e270e64990..b27d7917377 100644
--- a/intern/ghost/intern/GHOST_SystemCarbon.h
+++ b/intern/ghost/intern/GHOST_SystemCarbon.h
@@ -190,6 +190,20 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
+ /**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ virtual GHOST_TUns8* getSystemDir() const;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ virtual GHOST_TUns8* getUserDir() const;
+
protected:
/**
* Initializes the system.
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h
index 67b97dd7a1e..c533e551065 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.h
+++ b/intern/ghost/intern/GHOST_SystemCocoa.h
@@ -214,6 +214,20 @@ public:
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ virtual GHOST_TUns8* getSystemDir() const = 0;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ virtual GHOST_TUns8* getUserDir() const = 0;
+
+ /**
* Handles a window event. Called by GHOST_WindowCocoa window delegate
* @param eventType The type of window event
* @param window The window on which the event occured
diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm
index 90dad2f1d96..382089283d3 100644
--- a/intern/ghost/intern/GHOST_SystemCocoa.mm
+++ b/intern/ghost/intern/GHOST_SystemCocoa.mm
@@ -1736,3 +1736,13 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const
[pool drain];
}
+
+GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
+{
+
+}
+
+GHOST_TUns8* GHOST_SystemX11::getUserDir() const
+{
+
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp
index e6422d25494..6695bd56727 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.cpp
+++ b/intern/ghost/intern/GHOST_SystemWin32.cpp
@@ -1095,3 +1095,12 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const
}
}
+GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
+{
+
+}
+
+GHOST_TUns8* GHOST_SystemX11::getUserDir() const
+{
+
+}
diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h
index dd0b6dee0ed..1b7b2aad766 100644
--- a/intern/ghost/intern/GHOST_SystemWin32.h
+++ b/intern/ghost/intern/GHOST_SystemWin32.h
@@ -187,6 +187,21 @@ public:
*/
virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
+
+ /**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ GHOST_TUns8* getSystemDir() const;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ GHOST_TUns8* getUserDir() const;
+
/**
* Creates a drag'n'drop event and pushes it immediately onto the event queue.
* Called by GHOST_DropTargetWin32 class.
diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp
index fc99ffbdd47..5eab71eebf5 100644
--- a/intern/ghost/intern/GHOST_SystemX11.cpp
+++ b/intern/ghost/intern/GHOST_SystemX11.cpp
@@ -1457,3 +1457,22 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const
fprintf(stderr, "failed to own primary\n");
}
}
+
+GHOST_TUns8* GHOST_SystemX11::getSystemDir() const
+{
+
+}
+
+GHOST_TUns8* GHOST_SystemX11::getUserDir() const
+{
+ char* path;
+ char* env = getenv("HOME");
+ if(env) {
+ path = (char*) malloc(strlen(env) + 10); // "/.blender/"
+ strcat(path, env);
+ strcat(path, "/,blender/");
+ return (GHOST_TUns8*) path;
+ } else {
+ return NULL;
+ }
+}
diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h
index 1620d52ee65..b839b5a057a 100644
--- a/intern/ghost/intern/GHOST_SystemX11.h
+++ b/intern/ghost/intern/GHOST_SystemX11.h
@@ -227,6 +227,20 @@ public:
void putClipboard(GHOST_TInt8 *buffer, bool selection) const;
/**
+ * Determine the base dir in which shared resources are located. It will first try to use
+ * "unpack and run" path, then look for properly installed path, not including versioning.
+ * @return Unsigned char string pointing to system dir (eg /usr/share/blender/).
+ */
+ GHOST_TUns8* getSystemDir() const;
+
+ /**
+ * Determine the base dir in which user configuration is stored, not including versioning.
+ * If needed, it will create the base directory.
+ * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ */
+ GHOST_TUns8* getUserDir() const;
+
+ /**
* Atom used for ICCCM, WM-spec and Motif.
* We only need get this atom at the start, it's relative
* to the display not the window and are public for every