Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
53b7c1b7
Commit
53b7c1b7
authored
Sep 16, 2008
by
Pierre d'Herbemont
Committed by
Felix Paul Kühne
Sep 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
macosx: Check for older preferences and ask to delete them.
Signed-off-by:
Felix Paul Kühne
<
fkuehne@videolan.org
>
parent
9b880b56
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
0 deletions
+50
-0
modules/gui/macosx/intf.m
modules/gui/macosx/intf.m
+50
-0
No files found.
modules/gui/macosx/intf.m
View file @
53b7c1b7
...
...
@@ -212,6 +212,11 @@ static int InteractCallback( vlc_object_t *p_this, const char *psz_variable,
}
#pragma mark -
#pragma mark Private
@interface
VLCMain
()
-
(
void
)
_removeOldPreferences
;
@end
/*****************************************************************************
* VLCMain implementation
...
...
@@ -460,6 +465,8 @@ static VLCMain *_o_sharedMainInstance = nil;
-
(
void
)
applicationDidFinishLaunching
:(
NSNotification
*
)
aNotification
{
[
self
_removeOldPreferences
];
#ifdef UPDATE_CHECK
/* Check for update silently on startup */
if
(
!
nib_update_loaded
)
...
...
@@ -2208,6 +2215,49 @@ end:
}
}
#pragma mark -
#pragma mark Remove old prefs
-
(
void
)
_removeOldPreferences
{
static
NSString
*
kVLCPreferencesVersion
=
@"VLCPreferencesVersion"
;
static
const
int
kCurrentPreferencesVersion
=
1
;
int
version
=
[[
NSUserDefaults
standardUserDefaults
]
integerForKey
:
kVLCPreferencesVersion
];
if
(
version
>=
kCurrentPreferencesVersion
)
return
;
NSArray
*
libraries
=
NSSearchPathForDirectoriesInDomains
(
NSLibraryDirectory
,
NSUserDomainMask
,
YES
);
if
(
!
libraries
||
[
libraries
count
]
==
0
)
return
;
NSString
*
preferences
=
[[
libraries
objectAtIndex
:
0
]
stringByAppendingPathComponent
:
@"Preferences"
];
/* File not found, don't attempt anything */
if
(
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
preferences
stringByAppendingPathComponent
:
@"VLC"
]]
&&
!
[[
NSFileManager
defaultManager
]
fileExistsAtPath
:[
preferences
stringByAppendingPathComponent
:
@"org.videolan.vlc.plist"
]]
)
{
[[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
return
;
}
int
res
=
NSRunInformationalAlertPanel
(
_NS
(
"Remove old preferences?"
),
_NS
(
"We just found an older version of VLC's preferences files."
),
_NS
(
"Move To Trash and Relaunch VLC"
),
_NS
(
"Ignore"
),
nil
,
nil
);
if
(
res
!=
NSOKButton
)
return
;
NSArray
*
ourPreferences
=
[
NSArray
arrayWithObjects
:
@"org.videolan.vlc.plist"
,
@"VLC"
];
/* Move the file to trash so that user can find them later */
[[
NSWorkspace
sharedWorkspace
]
performFileOperation
:
NSWorkspaceRecycleOperation
source
:
preferences
destination
:
nil
files
:
ourPreferences
tag
:
0
];
/* really reset the defaults from now on */
[
NSUserDefaults
resetStandardUserDefaults
];
[[
NSUserDefaults
standardUserDefaults
]
setInteger
:
kCurrentPreferencesVersion
forKey
:
kVLCPreferencesVersion
];
/* Relaunch now */
[[
NSWorkspace
sharedWorkspace
]
launchApplication
:[[
NSBundle
mainBundle
]
bundlePath
]];
exit
(
0
);
}
#pragma mark -
#pragma mark Errors, warnings and messages
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment