~ubuntu-branches/ubuntu/trusty/blender/trusty

« back to all changes in this revision

Viewing changes to intern/ghost/intern/GHOST_SystemPathsWin32.cpp

  • Committer: Package Import Robot
  • Author(s): Jeremy Bicha
  • Date: 2013-03-06 12:08:47 UTC
  • mfrom: (1.5.1) (14.1.8 experimental)
  • Revision ID: package-import@ubuntu.com-20130306120847-frjfaryb2zrotwcg
Tags: 2.66a-1ubuntu1
* Resynchronize with Debian (LP: #1076930, #1089256, #1052743, #999024,
  #1122888, #1147084)
* debian/control:
  - Lower build-depends on libavcodec-dev since we're not
    doing the libav9 transition in Ubuntu yet

Show diffs side-by-side

added added

removed removed

Lines of Context:
69
69
{
70
70
}
71
71
 
72
 
const GHOST_TUns8* GHOST_SystemPathsWin32::getSystemDir() const
 
72
const GHOST_TUns8 *GHOST_SystemPathsWin32::getSystemDir(int, const char *versionstr) const
73
73
{
74
 
        static char knownpath[MAX_PATH*3] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
 
74
        static char knownpath[MAX_PATH * 3 + 128] = {0}; /* 1 utf-16 might translante into 3 utf-8. 2 utf-16 translates into 4 utf-8*/
75
75
        wchar_t knownpath_16[MAX_PATH];
76
76
 
77
77
        HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_COMMON_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
78
78
 
79
79
        if (hResult == S_OK)
80
80
        {
81
 
                conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
 
81
                conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
 
82
                strcat(knownpath, "\\Blender Foundation\\Blender\\");
 
83
                strcat(knownpath, versionstr);
82
84
                return (GHOST_TUns8*)knownpath;
83
85
        }
84
86
 
85
87
        return NULL;
86
88
}
87
89
 
88
 
const GHOST_TUns8* GHOST_SystemPathsWin32::getUserDir() const
 
90
const GHOST_TUns8 *GHOST_SystemPathsWin32::getUserDir(int, const char *versionstr) const
89
91
{
90
 
        static char knownpath[MAX_PATH*3] = {0};
91
 
        wchar_t  knownpath_16[MAX_PATH];
 
92
        static char knownpath[MAX_PATH * 3 + 128] = {0};
 
93
        wchar_t knownpath_16[MAX_PATH];
92
94
 
93
95
        HRESULT hResult = SHGetFolderPathW(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT, knownpath_16);
94
96
 
95
97
        if (hResult == S_OK)
96
98
        {
97
 
                conv_utf_16_to_8(knownpath_16,knownpath,MAX_PATH*3);
 
99
                conv_utf_16_to_8(knownpath_16, knownpath, MAX_PATH * 3);
 
100
                strcat(knownpath, "\\Blender Foundation\\Blender\\");
 
101
                strcat(knownpath, versionstr);
98
102
                return (GHOST_TUns8*)knownpath;
99
103
        }
100
104
 
101
105
        return NULL;
102
106
}
103
107
 
104
 
const GHOST_TUns8* GHOST_SystemPathsWin32::getBinaryDir() const
 
108
const GHOST_TUns8 *GHOST_SystemPathsWin32::getBinaryDir() const
105
109
{
106
 
        static char fullname[MAX_PATH*3] = {0};
107
 
        wchar_t  fullname_16[MAX_PATH*3];
 
110
        static char fullname[MAX_PATH * 3] = {0};
 
111
        wchar_t fullname_16[MAX_PATH * 3];
108
112
 
109
 
        if(GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
110
 
                conv_utf_16_to_8(fullname_16,fullname,MAX_PATH*3);
111
 
                return (GHOST_TUns8*)fullname;
 
113
        if (GetModuleFileNameW(0, fullname_16, MAX_PATH)) {
 
114
                conv_utf_16_to_8(fullname_16, fullname, MAX_PATH * 3);
 
115
                return (GHOST_TUns8 *)fullname;
112
116
        }
113
117
 
114
118
        return NULL;