124 } |
124 } |
125 else |
125 else |
126 { |
126 { |
127 aPath.Append( PathInfo::ImagesPath() ); |
127 aPath.Append( PathInfo::ImagesPath() ); |
128 } |
128 } |
129 |
129 // Copied from below |
|
130 TBuf<KMaxNameBaseLength> cameraFolder; // "Camera" |
|
131 StringLoader::Load( cameraFolder, R_CAM_CAMERA_SUBFOLDER ); |
|
132 |
|
133 RFs rfs; |
|
134 User::LeaveIfError( rfs.Connect() ); |
|
135 CleanupClosePushL( rfs ); |
|
136 |
|
137 TFileName fn( aPath ); |
|
138 fn.Append( cameraFolder ); |
|
139 TEntry entry; |
|
140 TInt err2 = rfs.Entry(fn, entry ); |
|
141 |
|
142 if( KErrNone == err2 ) |
|
143 { |
|
144 if (!entry.IsDir( )) |
|
145 { |
|
146 RBuf newName; |
|
147 CleanupClosePushL( newName); |
|
148 newName.CreateL( fn.Length() + 4 ); |
|
149 newName.Copy( fn ); |
|
150 newName.Append(_L(".bak")); |
|
151 TInt error = rfs.Rename( fn, newName ); |
|
152 if ( error != KErrNone ) |
|
153 { |
|
154 User::LeaveIfError( rfs.Delete( fn ) ); |
|
155 } |
|
156 CleanupStack::PopAndDestroy( &newName ); |
|
157 } |
|
158 } |
130 // Add a folder for the current month |
159 // Add a folder for the current month |
131 // Use the specified time to determine the year and month. |
160 // Use the specified time to determine the year and month. |
132 // If this is 0 then use the current time. |
161 // If this is 0 then use the current time. |
133 TTime now = aTime; |
162 TTime now = aTime; |
134 if ( now.Int64() == TInt64( 0 ) ) |
163 if ( now.Int64() == TInt64( 0 ) ) |
152 ResetCounters( aMonthCounters ); |
181 ResetCounters( aMonthCounters ); |
153 // Write month folder name to shared data |
182 // Write month folder name to shared data |
154 cr->Set( KCamCrLastUsedMonthFolder, monthFolder ); |
183 cr->Set( KCamCrLastUsedMonthFolder, monthFolder ); |
155 } |
184 } |
156 CleanupStack::PopAndDestroy( cr ); |
185 CleanupStack::PopAndDestroy( cr ); |
157 TBuf<KMaxNameBaseLength> cameraFolder; |
186 // TBuf<KMaxNameBaseLength> cameraFolder; |
158 StringLoader::Load( cameraFolder, R_CAM_CAMERA_SUBFOLDER ); |
187 // StringLoader::Load( cameraFolder, R_CAM_CAMERA_SUBFOLDER ); |
159 aPath.Append( cameraFolder ); |
188 aPath.Append( cameraFolder ); |
160 aPath.Append( KBackslash ); |
189 aPath.Append( KBackslash ); |
161 aPath.Append( monthFolder ); |
190 aPath.Append( monthFolder ); |
162 aPath.Append( KBackslash ); |
191 aPath.Append( KBackslash ); |
163 |
192 |
164 // Keep track of the month folder (YYYYMM) name length |
193 // Keep track of the month folder (YYYYMM) name length |
165 // This may be returned e.g.if the month counter destination folder (YYYYMMXX) is |
194 // This may be returned e.g.if the month counter destination folder (YYYYMMXX) is |
166 // not created |
195 // not created |
167 TInt monthFolderLength = aPath.Length(); |
196 TInt monthFolderLength = aPath.Length(); |
168 |
197 |
169 RFs rfs; |
|
170 User::LeaveIfError( rfs.Connect() ); |
|
171 CleanupClosePushL( rfs ); |
|
172 |
|
173 // ensure the path exists |
198 // ensure the path exists |
174 TInt err = rfs.MkDirAll( aPath ); |
199 TInt err = rfs.MkDirAll( aPath ); |
175 |
200 |
176 // If the folder is newly created then set the counter to 0 |
201 // If the folder is newly created then set the counter to 0 |
177 if ( KErrNone == err ) aMonthCounters[folderTypeIndex] = 0; |
202 if ( KErrNone == err ) aMonthCounters[folderTypeIndex] = 0; |
205 TInt monthCounter = aMonthCounters[folderTypeIndex]; |
230 TInt monthCounter = aMonthCounters[folderTypeIndex]; |
206 aPath.Append( KCharacterOffset()[0] + monthCounter/KBase10 ); |
231 aPath.Append( KCharacterOffset()[0] + monthCounter/KBase10 ); |
207 aPath.Append( KDigitOffset()[0] + monthCounter%KBase10 ); |
232 aPath.Append( KDigitOffset()[0] + monthCounter%KBase10 ); |
208 aPath.Append( KBackslash ); |
233 aPath.Append( KBackslash ); |
209 // If the folder does not exist then remove the final folder name from the path |
234 // If the folder does not exist then remove the final folder name from the path |
210 TEntry entry; |
235 //TEntry entry; |
|
236 |
211 if ( rfs.Entry( aPath, entry ) == KErrNotFound ) |
237 if ( rfs.Entry( aPath, entry ) == KErrNotFound ) |
212 { |
238 { |
213 aPath.SetLength( monthFolderLength ); |
239 aPath.SetLength( monthFolderLength ); |
214 } |
240 } |
215 } |
241 } |