Changeset 62816 in vbox for trunk/src/VBox/GuestHost
- Timestamp:
- Aug 1, 2016 1:02:02 PM (9 years ago)
- svn:sync-xref-src-repo-rev:
- 109403
- Location:
- trunk/src/VBox/GuestHost/DragAndDrop
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/DragAndDrop/DnDDroppedFiles.cpp
r62492 r62816 111 111 { 112 112 char pszDropDir[RTPATH_MAX]; 113 size_t cchDropDir =RTStrPrintf(pszDropDir, sizeof(pszDropDir), "%s", pszPath);113 RTStrPrintf(pszDropDir, sizeof(pszDropDir), "%s", pszPath); 114 114 115 115 /** @todo On Windows we also could use the registry to override … … 229 229 if (RT_SUCCESS(rc2)) 230 230 this->m_lstFiles.removeAt(i); 231 232 if (RT_SUCCESS(rc)) 231 else if (RT_SUCCESS(rc)) 233 232 rc = rc2; 234 233 /* Keep going. */ … … 240 239 if (RT_SUCCESS(rc2)) 241 240 this->m_lstDirs.removeAt(i); 242 243 if (RT_SUCCESS(rc)) 241 else if (RT_SUCCESS(rc)) 244 242 rc = rc2; 245 243 /* Keep going. */ … … 258 256 rc2 = RTDirRemove(this->m_strPathAbs.c_str()); 259 257 } 260 } 261 262 if (RT_SUCCESS(rc)) 263 rc = rc2; 264 265 LogFlowFuncLeaveRC(rc); 266 return rc; 267 } 268 258 if (RT_SUCCESS(rc)) 259 rc = rc2; 260 } 261 262 LogFlowFuncLeaveRC(rc); 263 return rc; 264 } 265 -
trunk/src/VBox/GuestHost/DragAndDrop/DnDPath.cpp
r62492 r62816 1 1 /* $Id$ */ 2 2 /** @file 3 * DnD :Path handling.3 * DnD - Path handling. 4 4 */ 5 5 … … 38 38 int rc = VINF_SUCCESS; 39 39 #ifdef RT_OS_WINDOWS 40 RT_NOREF1(cbPath); 40 41 /* Filter out characters not allowed on Windows platforms, put in by 41 42 RTTimeSpecToString(). */ 42 43 /** @todo Use something like RTPathSanitize() when available. Later. */ 43 RTUNICP aCpSet[] = 44 { ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_', 45 0xa0, 0xd7af, '\0' }; 46 ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, aCpSet, '_' /* Replacement */); 44 static const RTUNICP s_aCpSet[] = 45 { 46 ' ', ' ', '(', ')', '-', '.', '0', '9', 'A', 'Z', 'a', 'z', '_', '_', 47 0xa0, 0xd7af, '\0' 48 }; 49 ssize_t cReplaced = RTStrPurgeComplementSet(pszPath, s_aCpSet, '_' /* Replacement */); 47 50 if (cReplaced < 0) 48 51 rc = VERR_INVALID_UTF8_ENCODING; 52 #else 53 RT_NOREF2(pszPath, cbPath); 49 54 #endif 50 55 return rc; … … 54 59 { 55 60 /** @todo */ 61 RT_NOREF2(pszPath, cbPath); 56 62 return VINF_SUCCESS; 57 63 } -
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIList.cpp
r62492 r62816 129 129 rc = addEntry(pcszSrcPath, &pcszDstPath[cchDstBase], fFlags); 130 130 131 PRTDIR hDir;132 131 if (RT_SUCCESS(rc)) 132 { 133 PRTDIR hDir; 133 134 rc = RTDirOpen(&hDir, pcszSrcPath); 134 if (RT_SUCCESS(rc)) 135 { 136 do 135 if (RT_SUCCESS(rc)) 137 136 { 138 RTDIRENTRY DirEntry; 139 rc = RTDirRead(hDir, &DirEntry, NULL); 140 if (RT_FAILURE(rc)) 137 do 141 138 { 142 if (rc == VERR_NO_MORE_FILES) 143 rc = VINF_SUCCESS; 144 break; 145 } 146 147 switch (DirEntry.enmType) 148 { 149 case RTDIRENTRYTYPE_DIRECTORY: 139 RTDIRENTRY DirEntry; 140 rc = RTDirRead(hDir, &DirEntry, NULL); 141 if (RT_FAILURE(rc)) 150 142 { 151 /* Skip "." and ".." entries. */ 152 if ( RTStrCmp(DirEntry.szName, ".") == 0 153 || RTStrCmp(DirEntry.szName, "..") == 0) 154 break; 155 156 char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName); 157 if (pszSrc) 158 { 159 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName); 160 if (pszDst) 161 { 162 rc = appendPathRecursive(pszSrc, pszDst, pcszDstBase, cchDstBase, fFlags); 163 RTStrFree(pszDst); 164 } 165 else 166 rc = VERR_NO_MEMORY; 167 168 RTStrFree(pszSrc); 169 } 170 else 171 rc = VERR_NO_MEMORY; 143 if (rc == VERR_NO_MORE_FILES) 144 rc = VINF_SUCCESS; 172 145 break; 173 146 } 174 147 175 case RTDIRENTRYTYPE_FILE:148 switch (DirEntry.enmType) 176 149 { 177 char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName); 178 if (pszSrc) 150 case RTDIRENTRYTYPE_DIRECTORY: 179 151 { 180 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName); 181 if (pszDst) 182 { 183 rc = addEntry(pszSrc, &pszDst[cchDstBase], fFlags); 184 RTStrFree(pszDst); 185 } 186 else 187 rc = VERR_NO_MEMORY; 188 RTStrFree(pszSrc); 189 } 190 else 191 rc = VERR_NO_MEMORY; 192 break; 193 } 194 case RTDIRENTRYTYPE_SYMLINK: 195 { 196 if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS) 197 { 198 char *pszSrc = RTPathRealDup(pcszDstBase); 152 /* Skip "." and ".." entries. */ 153 if ( RTStrCmp(DirEntry.szName, ".") == 0 154 || RTStrCmp(DirEntry.szName, "..") == 0) 155 break; 156 157 char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName); 199 158 if (pszSrc) 200 159 { 201 rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING);202 if ( RT_SUCCESS(rc))160 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName); 161 if (pszDst) 203 162 { 204 if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode)) 205 { 206 LogFlowFunc(("Directory entry is symlink to directory\n")); 207 rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags); 208 } 209 else if (RTFS_IS_FILE(objInfo.Attr.fMode)) 210 { 211 LogFlowFunc(("Directory entry is symlink to file\n")); 212 rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags); 213 } 214 else 215 rc = VERR_NOT_SUPPORTED; 163 rc = appendPathRecursive(pszSrc, pszDst, pcszDstBase, cchDstBase, fFlags); 164 RTStrFree(pszDst); 216 165 } 166 else 167 rc = VERR_NO_MEMORY; 217 168 218 169 RTStrFree(pszSrc); … … 220 171 else 221 172 rc = VERR_NO_MEMORY; 173 break; 222 174 } 223 break; 175 176 case RTDIRENTRYTYPE_FILE: 177 { 178 char *pszSrc = RTPathJoinA(pcszSrcPath, DirEntry.szName); 179 if (pszSrc) 180 { 181 char *pszDst = RTPathJoinA(pcszDstPath, DirEntry.szName); 182 if (pszDst) 183 { 184 rc = addEntry(pszSrc, &pszDst[cchDstBase], fFlags); 185 RTStrFree(pszDst); 186 } 187 else 188 rc = VERR_NO_MEMORY; 189 RTStrFree(pszSrc); 190 } 191 else 192 rc = VERR_NO_MEMORY; 193 break; 194 } 195 case RTDIRENTRYTYPE_SYMLINK: 196 { 197 if (fFlags & DNDURILIST_FLAGS_RESOLVE_SYMLINKS) 198 { 199 char *pszSrc = RTPathRealDup(pcszDstBase); 200 if (pszSrc) 201 { 202 rc = RTPathQueryInfo(pszSrc, &objInfo, RTFSOBJATTRADD_NOTHING); 203 if (RT_SUCCESS(rc)) 204 { 205 if (RTFS_IS_DIRECTORY(objInfo.Attr.fMode)) 206 { 207 LogFlowFunc(("Directory entry is symlink to directory\n")); 208 rc = appendPathRecursive(pszSrc, pcszDstPath, pcszDstBase, cchDstBase, fFlags); 209 } 210 else if (RTFS_IS_FILE(objInfo.Attr.fMode)) 211 { 212 LogFlowFunc(("Directory entry is symlink to file\n")); 213 rc = addEntry(pszSrc, &pcszDstPath[cchDstBase], fFlags); 214 } 215 else 216 rc = VERR_NOT_SUPPORTED; 217 } 218 219 RTStrFree(pszSrc); 220 } 221 else 222 rc = VERR_NO_MEMORY; 223 } 224 break; 225 } 226 227 default: 228 break; 224 229 } 225 230 226 default: 227 break; 228 } 229 230 } while (RT_SUCCESS(rc)); 231 232 RTDirClose(hDir); 231 } while (RT_SUCCESS(rc)); 232 233 RTDirClose(hDir); 234 } 233 235 } 234 236 } … … 446 448 int DnDURIList::RootFromURIData(const void *pvData, size_t cbData, uint32_t fFlags) 447 449 { 450 Assert(fFlags == 0); RT_NOREF1(fFlags); 448 451 AssertPtrReturn(pvData, VERR_INVALID_POINTER); 449 452 AssertReturn(cbData, VERR_INVALID_PARAMETER); -
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
r59838 r62816 134 134 uint64_t fOpen /* = 0 */, uint32_t fMode /* = 0 */, uint32_t fFlags /* = 0 */) 135 135 { 136 Assert(fFlags == 0); RT_NOREF1(fFlags); 136 137 int rc = VINF_SUCCESS; 137 138
Note:
See TracChangeset
for help on using the changeset viewer.