Changeset 25942 in vbox for trunk/src/VBox/Main/glue/com.cpp
- Timestamp:
- Jan 20, 2010 5:26:22 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56784
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/com.cpp
r22708 r25942 138 138 } 139 139 140 int GetVBoxUserHomeDirectory 140 int GetVBoxUserHomeDirectory(char *aDir, size_t aDirLen) 141 141 { 142 142 AssertReturn(aDir, VERR_INVALID_POINTER); … … 146 146 *aDir = 0; 147 147 148 const char *VBoxUserHome = RTEnvGet 148 const char *VBoxUserHome = RTEnvGet("VBOX_USER_HOME"); 149 149 150 150 char path [RTPATH_MAX]; … … 155 155 /* get the full path name */ 156 156 char *VBoxUserHomeUtf8 = NULL; 157 vrc = RTStrCurrentCPToUtf8 157 vrc = RTStrCurrentCPToUtf8(&VBoxUserHomeUtf8, VBoxUserHome); 158 158 if (RT_SUCCESS(vrc)) 159 159 { 160 vrc = RTPathAbs 160 vrc = RTPathAbs(VBoxUserHomeUtf8, path, sizeof (path)); 161 161 if (RT_SUCCESS(vrc)) 162 162 { 163 if (aDirLen < strlen 163 if (aDirLen < strlen(path) + 1) 164 164 vrc = VERR_BUFFER_OVERFLOW; 165 165 else 166 strcpy 166 strcpy(aDir, path); 167 167 } 168 RTStrFree 168 RTStrFree(VBoxUserHomeUtf8); 169 169 } 170 170 } … … 172 172 { 173 173 /* compose the config directory (full path) */ 174 vrc = RTPathUserHome (path, sizeof(path));174 vrc = RTPathUserHome(path, sizeof(path)); 175 175 if (RT_SUCCESS(vrc)) 176 176 { 177 size_t len = 178 RTStrPrintf (aDir, aDirLen, "%s%c%s", 179 path, RTPATH_DELIMITER, VBOX_USER_HOME_SUFFIX); 180 if (len != strlen (path) + 1 + strlen (VBOX_USER_HOME_SUFFIX)) 177 size_t len = RTStrPrintf(aDir, aDirLen, "%s%c%s", 178 path, RTPATH_DELIMITER, VBOX_USER_HOME_SUFFIX); 179 if (len != strlen(path) + 1 + strlen (VBOX_USER_HOME_SUFFIX)) 181 180 vrc = VERR_BUFFER_OVERFLOW; 182 181 } … … 185 184 /* ensure the home directory exists */ 186 185 if (RT_SUCCESS(vrc)) 187 if (!RTDirExists 188 vrc = RTDirCreateFullPath 186 if (!RTDirExists(aDir)) 187 vrc = RTDirCreateFullPath(aDir, 0777); 189 188 190 189 return vrc;
Note:
See TracChangeset
for help on using the changeset viewer.