ObjFW  Check-in [ffc622db15]

Overview
Comment:Add OFCreateDirectoryFailedException.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: ffc622db156dff63db9eee0e0d3ec149a4fc4a1b8fc174ed429f5e556df2723f
User & Date: js on 2010-04-15 08:43:01
Other Links: manifest | tags
Context
2010-04-15
08:43
Add +[createDirectoryAtPath:] to OFFile. check-in: 2ef0a01201 user: js tags: trunk
08:43
Add OFCreateDirectoryFailedException. check-in: ffc622db15 user: js tags: trunk
08:11
Add +[directoryExistsAtPath:] and +[filesInDirectoryAtPath:] to OFFile. check-in: 8d84aa00aa user: js tags: trunk
Changes

Modified src/OFExceptions.h from [2ecc9888d8] to [ff60e9a5c7].

242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/**
 * \brief An exception indicating a file couldn't be opened.
 */
@interface OFOpenFileFailedException: OFException
{
	OFString *path;
	OFString *mode;
	int  err;
}

/**
 * \param class_ The class of the object which caused the exception
 * \param path A string of the path to the file tried to open
 * \param mode A string of the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithClass: (Class)class_
	  path: (OFString*)path
	  mode: (OFString*)mode;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param class_ The class of the object which caused the exception
 * \param path A string of the path to the file which couldn't be opened
 * \param mode A string of the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- initWithClass: (Class)class_
	   path: (OFString*)path
	   mode: (OFString*)mode;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string of the path to the file which couldn't be opened
 */
- (OFString*)path;

/**
 * \return A string of the mode in which the file should have been opened
 */
- (OFString*)mode;
@end

/**
 * \brief An exception indicating a read or write to a stream failed.
 */







|




|
|










|
|












|




|







242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/**
 * \brief An exception indicating a file couldn't be opened.
 */
@interface OFOpenFileFailedException: OFException
{
	OFString *path;
	OFString *mode;
	int err;
}

/**
 * \param class_ The class of the object which caused the exception
 * \param path A string with the path of the file tried to open
 * \param mode A string with the mode in which the file should have been opened
 * \return A new open file failed exception
 */
+ newWithClass: (Class)class_
	  path: (OFString*)path
	  mode: (OFString*)mode;

/**
 * Initializes an already allocated open file failed exception.
 *
 * \param class_ The class of the object which caused the exception
 * \param path A string with the path of the file which couldn't be opened
 * \param mode A string with the mode in which the file should have been opened
 * \return An initialized open file failed exception
 */
- initWithClass: (Class)class_
	   path: (OFString*)path
	   mode: (OFString*)mode;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string with the path of the file which couldn't be opened
 */
- (OFString*)path;

/**
 * \return A string with the mode in which the file should have been opened
 */
- (OFString*)mode;
@end

/**
 * \brief An exception indicating a read or write to a stream failed.
 */
347
348
349
350
351
352
353






































354
355
356
357
358
359
360

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
@end







































/**
 * \brief An exception indicating that changing the mode of a file failed.
 */
@interface OFChangeFileModeFailedException: OFException
{
	OFString *path;
	mode_t mode;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;
@end

/**
 * \brief An exception indicating a directory couldn't be created.
 */
@interface OFCreateDirectoryFailedException: OFException
{
	OFString *path;
	int err;
}

/**
 * \param class_ The class of the object which caused the exception
 * \param path A string with the path of the directory which couldn't be created
 * \return A new create directory failed exception
 */
+ newWithClass: (Class)class_
	  path: (OFString*)path;

/**
 * Initializes an already allocated create directory failed exception.
 *
 * \param class_ The class of the object which caused the exception
 * \param path A string with the path of the directory which couldn't be created
 * \return An initialized create directory failed exception
 */
- initWithClass: (Class)class_
	   path: (OFString*)path;

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string with the path of the file which couldn't be opened
 */
- (OFString*)path;
@end

/**
 * \brief An exception indicating that changing the mode of a file failed.
 */
@interface OFChangeFileModeFailedException: OFException
{
	OFString *path;
	mode_t mode;
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string of the source for the link
 */
- (OFString*)source;

/**
 * \return A string of the destination for the link
 */
- (OFString*)destination;
@end

/**
 * \brief An exception indicating that creating a symlink failed.
 */







|




|







618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string with the source for the link
 */
- (OFString*)source;

/**
 * \return A string with the destination for the link
 */
- (OFString*)destination;
@end

/**
 * \brief An exception indicating that creating a symlink failed.
 */
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string of the source for the symlink
 */
- (OFString*)source;

/**
 * \return A string of the destination for the symlink
 */
- (OFString*)destination;
@end
#endif

/**
 * \brief An exception indicating that setting an option failed.







|




|







666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685

/**
 * \return The errno from when the exception was created
 */
- (int)errNo;

/**
 * \return A string with the source for the symlink
 */
- (OFString*)source;

/**
 * \return A string with the destination for the symlink
 */
- (OFString*)destination;
@end
#endif

/**
 * \brief An exception indicating that setting an option failed.

Modified src/OFExceptions.m from [ad317396bc] to [8a8ab778d8].

510
511
512
513
514
515
516























































517
518
519
520
521
522
523
}

- (int)errNo
{
	return err;
}
@end
























































@implementation OFChangeFileModeFailedException
+ newWithClass: (Class)class__
	  path: (OFString*)path_
	  mode: (mode_t)mode_
{
	return [(OFChangeFileModeFailedException*)[self alloc]







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
}

- (int)errNo
{
	return err;
}
@end

@implementation OFCreateDirectoryFailedException
+ newWithClass: (Class)class__
	  path: (OFString*)path_
{
	return [[self alloc] initWithClass: class__
				      path: path_];
}

- initWithClass: (Class)class__
{
	@throw [OFNotImplementedException newWithClass: isa
					      selector: _cmd];
}

- initWithClass: (Class)class__
	   path: (OFString*)path_
{
	self = [super initWithClass: class__];

	path = [path_ copy];
	err  = GET_ERR;

	return self;
}

- (void)dealloc
{
	[path release];

	[super dealloc];
}

- (OFString*)string
{
	if (string != nil)
		return string;

	string = [[OFString alloc] initWithFormat:
	    @"Failed to create directory %s in class %s! " ERRFMT,
	    [path cString], [class_ className], ERRPARAM];

	return string;
}

- (int)errNo
{
	return err;
}

- (OFString*)path
{
	return path;
}
@end

@implementation OFChangeFileModeFailedException
+ newWithClass: (Class)class__
	  path: (OFString*)path_
	  mode: (mode_t)mode_
{
	return [(OFChangeFileModeFailedException*)[self alloc]