diff --git a/picard/ui/options/renaming.py b/picard/ui/options/renaming.py index 3d6deac18..6615302d4 100644 --- a/picard/ui/options/renaming.py +++ b/picard/ui/options/renaming.py @@ -202,6 +202,20 @@ class RenamingOptionsPage(OptionsPage): if not IS_WIN: self.ui.windows_compatibility.setEnabled(active) + def toggle_windows_long_paths(self, state): + if state and not system_supports_long_paths(): + dialog = QtWidgets.QMessageBox( + QtWidgets.QMessageBox.Icon.Information, + _('Windows long path support'), + _( + 'Enabling long paths on Windows might cause files being saved with path names ' + 'exceeding the 259 character limit traditionally imposed by the Windows API. ' + 'Some software might not be able to properly access those files.' + ), + QtWidgets.QMessageBox.StandardButton.Ok, + self) + dialog.exec_() + def save_from_editor(self): self.script_text = self.script_editor_dialog.get_script() self.update_selector_from_editor() @@ -238,6 +252,10 @@ class RenamingOptionsPage(OptionsPage): def load(self): config = get_config() + try: + self.ui.windows_long_paths.toggled.disconnect(self.toggle_windows_long_paths) + except TypeError: + pass if IS_WIN: self.ui.windows_compatibility.setChecked(True) self.ui.windows_compatibility.setEnabled(False) @@ -259,6 +277,7 @@ class RenamingOptionsPage(OptionsPage): else: self.update_selector_from_settings() self.update_examples_from_local() + self.ui.windows_long_paths.toggled.connect(self.toggle_windows_long_paths) def check(self): self.check_format()