Changeset 85017 in vbox for trunk/src/VBox/GuestHost/DragAndDrop
- Timestamp:
- Jul 1, 2020 10:34:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/GuestHost/DragAndDrop/DnDURIObject.cpp
r85005 r85017 34 34 35 35 DnDURIObject::DnDURIObject(Type enmType /* = Type_Unknown */, const RTCString &strPathAbs /* = "" */) 36 : m_enmType(Type_Unknown) 36 37 { 37 38 int rc2 = Init(enmType, strPathAbs); … … 57 58 case Type_File: 58 59 { 59 LogRel2(("DnD: Closing file '%s'\n", m_strPathAbs.c_str())); 60 61 rc = RTFileClose(u.File.hFile); 62 if (RT_SUCCESS(rc)) 60 if (RTFileIsValid(u.File.hFile)) 63 61 { 64 u.File.hFile = NIL_RTFILE; 65 RT_ZERO(u.File.objInfo); 62 LogRel2(("DnD: Closing file '%s'\n", m_strPathAbs.c_str())); 63 64 rc = RTFileClose(u.File.hFile); 65 if (RT_SUCCESS(rc)) 66 { 67 u.File.hFile = NIL_RTFILE; 68 RT_ZERO(u.File.objInfo); 69 } 70 else 71 LogRel(("DnD: Closing file '%s' failed with %Rrc\n", m_strPathAbs.c_str(), rc)); 66 72 } 67 else68 LogRel(("DnD: Closing file '%s' failed with %Rrc\n", m_strPathAbs.c_str(), rc));69 73 break; 70 74 } … … 72 76 case Type_Directory: 73 77 { 74 LogRel2(("DnD: Closing directory '%s'\n", m_strPathAbs.c_str())); 75 76 rc = RTDirClose(u.Dir.hDir); 77 if (RT_SUCCESS(rc)) 78 if (RTDirIsValid(u.Dir.hDir)) 78 79 { 79 u.Dir.hDir = NIL_RTDIR; 80 RT_ZERO(u.Dir.objInfo); 80 LogRel2(("DnD: Closing directory '%s'\n", m_strPathAbs.c_str())); 81 82 rc = RTDirClose(u.Dir.hDir); 83 if (RT_SUCCESS(rc)) 84 { 85 u.Dir.hDir = NIL_RTDIR; 86 RT_ZERO(u.Dir.objInfo); 87 } 88 else 89 LogRel(("DnD: Closing directory '%s' failed with %Rrc\n", m_strPathAbs.c_str(), rc)); 81 90 } 82 else83 LogRel(("DnD: Closing directory '%s' failed with %Rrc\n", m_strPathAbs.c_str(), rc));84 91 break; 85 92 } … … 163 170 int DnDURIObject::Init(Type enmType, const RTCString &strPathAbs /* = */) 164 171 { 165 AssertReturn( enmType == Type_Unknown, VERR_WRONG_ORDER);172 AssertReturn(m_enmType == Type_Unknown, VERR_WRONG_ORDER); 166 173 167 174 int rc; 168 175 169 switch ( m_enmType)176 switch (enmType) 170 177 { 171 178 case Type_File: … … 187 194 if (enmType != Type_Unknown) 188 195 { 189 AssertReturn(m_strPathAbs.isNotEmpty(), VERR_INVALID_PARAMETER); 190 rc = DnDPathConvert(m_strPathAbs.mutableRaw(), m_strPathAbs.capacity(), DNDPATHCONVERT_FLAGS_TO_NATIVE); 196 AssertReturn(strPathAbs.isNotEmpty(), VERR_INVALID_PARAMETER); 197 RTCString strPathAbsCopy = strPathAbs; 198 rc = DnDPathConvert(strPathAbsCopy.mutableRaw(), strPathAbsCopy.capacity(), DNDPATHCONVERT_FLAGS_TO_NATIVE); 191 199 if (RT_SUCCESS(rc)) 192 200 { 193 201 m_enmType = enmType; 194 m_strPathAbs = strPathAbs ;202 m_strPathAbs = strPathAbsCopy; 195 203 } 196 204 else 197 LogRel2(("DnD: Absolute file path for guest file on the host is now '%s'\n", m_strPathAbs.c_str()));205 LogRel2(("DnD: Absolute file path for guest file on the host is now '%s'\n", strPathAbs.c_str())); 198 206 } 199 207 else
Note:
See TracChangeset
for help on using the changeset viewer.