summaryrefslogtreecommitdiffstats
path: root/macosx/HBUtilities.m
diff options
context:
space:
mode:
authorritsuka <[email protected]>2014-07-16 06:20:57 +0000
committerritsuka <[email protected]>2014-07-16 06:20:57 +0000
commit0e165d0a096d606b52b1bcace1911c7d0c24be04 (patch)
treee2d54585d8518d8c69dd77335db0d78d1075c26b /macosx/HBUtilities.m
parent31283b442713147dc5edb5135cb6dbcbb95635e8 (diff)
MacGui: moved two methods used by the whole app to HBUtilities.m:
- appSupportPath: - writeToActivityLog: git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6232 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'macosx/HBUtilities.m')
-rw-r--r--macosx/HBUtilities.m29
1 files changed, 29 insertions, 0 deletions
diff --git a/macosx/HBUtilities.m b/macosx/HBUtilities.m
index 47666f923..1ccd78630 100644
--- a/macosx/HBUtilities.m
+++ b/macosx/HBUtilities.m
@@ -9,6 +9,35 @@
@implementation HBUtilities
++ (NSString *)appSupportPath
+{
+ NSString *appSupportPath = [[NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory,
+ NSUserDomainMask,
+ YES) firstObject] stringByAppendingPathComponent:@"HandBrake"];
+
+ NSFileManager *fileManager = [NSFileManager defaultManager];
+ if (![fileManager fileExistsAtPath:appSupportPath])
+ [fileManager createDirectoryAtPath:appSupportPath withIntermediateDirectories:YES attributes:nil error:NULL];
+
+ return appSupportPath;
+}
+
++ (void)writeToActivityLog:(const char *)format, ...
+{
+ va_list args;
+ va_start(args, format);
+ if (format != nil)
+ {
+ char str[1024];
+ vsnprintf(str, 1024, format, args);
+
+ time_t _now = time(NULL);
+ struct tm *now = localtime(&_now);
+ fprintf(stderr, "[%02d:%02d:%02d] macgui: %s\n", now->tm_hour, now->tm_min, now->tm_sec, str);
+ }
+ va_end(args);
+}
+
+ (NSString *)automaticNameForSource:(NSString *)sourceName
title:(NSUInteger)title
chapters:(NSRange)chaptersRange