def find_uppercase_filenames(path=None): # TODO: Needs to not break on recursive symlinks, as this tends to happen # when the user links to his/her home-dir. # TODO: Possibly convert to use the yield statement as this takes a while # and a GUI would most likely like to track the progress. if path == None: path = drives.get_main_drive(use_registry=False)['mapping'] filelist = [] filelist_conflicts = [] visited_paths = [] for root, dirs, files in os.walk(path, followlinks=True): absolute_root = os.path.realpath(root) if absolute_root in visited_paths: continue visited_paths.append(absolute_root) for name in files + dirs: lowname = name.lower() if name != lowname: full_name = os.path.join(root, name) if os.path.exists(os.path.join(root, lowname)): filelist_conflicts.append(full_name) else: filelist.append(full_name) return filelist, filelist_conflicts
def set_override(library, override): _override = override if library.endswith(".dll"): library = library[:-4] if type(override) is bool: if override: registry.set({ 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: "native,builtin" } }) else: registry.set({ 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: None } }) else: if type(override) is str: override = override.lower() if override.startswith('disable'): override = '' else: # make sure that the override is separated by only commas override = ','.join([ i.strip() for i in filter(len, override.replace(',', ' ').split()) ]) if library.lower() == 'comctl32': common.run([ 'rm', '-rf', util.wintounix("{0}\\windows\\winsxs\\manifests\\" + "x86_microsoft.windows." + "common-controls_6595b64144ccf1df_6.0." + "2600.2982_none_deadbeef.manifest".format( drives.get_main_drive(use_registry=False))) ]) if override in ('native', 'builtin', 'native,builtin', 'builtin,native', '', 'disabled', None): registry.set({ 'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: override } }) else: raise ValueError("Wrong value for override: {0}".format(_override))
def set_override(library, override): _override = override if library.endswith(".dll"): library = library[:-4] if type(override) is bool: if override: registry.set({'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: "native,builtin"}}) else: registry.set({'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: None}}) else: if type(override) is str: override = override.lower() if override.startswith('disable'): override = '' else: # make sure that the override is separated by only commas override = ','.join([ i.strip() for i in filter(len, override.replace(',', ' ').split()) ]) if library.lower() == 'comctl32': common.run([ 'rm', '-rf', util.wintounix( "{0}\\windows\\winsxs\\manifests\\"+ "x86_microsoft.windows."+ "common-controls_6595b64144ccf1df_6.0."+ "2600.2982_none_deadbeef.manifest".format( drives.get_main_drive(use_registry=False) ) ) ]) if override in ('native', 'builtin', 'native,builtin', 'builtin,native', '', 'disabled', None): registry.set({'HKEY_CURRENT_USER\\Software\\Wine\\DllOverrides': { library: override}}) else: raise ValueError("Wrong value for override: {0}".format(_override))
def open_terminal(cwd=None, configuration_name=None, cmd=None, arguments=[], disable_pulseaudio=False, keep_open=False): terminal, args = get_default_terminal() shell = get_user_default_shell() if cwd == None or not os.path.isdir(cwd): # If no (existing) current work dir was given, # choose the first virtual drive in the Wine configuration cwd = drives.get_main_drive(use_registry=False)['mapping'] env = common.ENV.copy() home = env['HOME'] = getRealHome() if configuration_name == None: conf_name = prefixes.get_name() else: conf_name = configuration_name shell_args = [] if conf_name != None: start_script_filename = tempname('terminal-script-', '.sh') start_script_file = open(start_script_filename, 'w') # Writes a shell script that mimics the normal interactive shell # behaviour and ends by prepending the Terminal title with the name # of the current configuration start_script_file.write(( 'PS1=dummy; '+ 'if [ -f /etc/profile ]; then '+ ' . /etc/profile; '+ 'fi; '+ 'if [ -f {home}/.bash_profile ]; then '+ ' . {home}/.bash_profile; '+ 'elif [ -f {home}/.bash_login ]; then '+ ' . {home}/.bash_login; '+ 'elif [ -f {home}/.profile ]; then '+ ' . {home}/.profile; '+ 'fi; '+ 'PS1=${{PS1/0;/0;{conf}: }}; '+ 'export PS1').format( home = env['HOME'], conf = conf_name) ) start_script_file.close() shell_args = ['--init-file', start_script_filename] if len(arguments): def _arg_escape(arg): shell_chars = (' ', '"', "'", '(', ')', '`', '$', '!') if common.any_in_string(shell_chars, arg): # return "'{0}'".format(string_escape_char(arg, "'")) return "'{0}'".format(arg.replace("'", """'"'"'""")) else: return arg shell_commands = '{0} {1}'.format( ('' if cmd == None else cmd), ' '.join( _arg_escape(arg) for arg in arguments ) ) if disable_pulseaudio: arguments = ['-c', 'killall pulseaudio; {0}; pulseaudio &'.format( shell_commands )] else: if keep_open: arguments = ['-c', '{0};echo; echo "{1}";read'.format( shell_commands, _("Press enter to close the terminal.") )] else: arguments = ['-c', '{0}'.format( shell_commands )] print([terminal]+args+[shell]+shell_args+arguments) process = subprocess.Popen( [terminal]+args+[shell]+shell_args+arguments, cwd=cwd, env=env, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) return process