MCPcopy Create free account
hub / github.com/bleachbit/bleachbit / guess_overwrite_paths

Function guess_overwrite_paths

bleachbit/FileUtilities.py:745–773  ·  view source on GitHub ↗

Guess which partitions to overwrite (to hide deleted files)

()

Source from the content-addressed store, hash-verified

743
744
745def guess_overwrite_paths():
746 """Guess which partitions to overwrite (to hide deleted files)"""
747 # In case overwriting leaves large files, placing them in
748 # ~/.config makes it easy to find them and clean them.
749 ret = []
750 if 'posix' == os.name:
751 home = os.path.expanduser('~/.cache')
752 if not os.path.exists(home):
753 home = os.path.expanduser("~")
754 ret.append(home)
755 # Debian on Docker did not have /tmp
756 if os.path.exists('/tmp'):
757 if not same_partition(home, '/tmp/'):
758 ret.append('/tmp')
759 elif 'nt' == os.name:
760 localtmp = os.path.expandvars('$TMP')
761 if not os.path.exists(localtmp):
762 logger.warning(
763 # TRANSLATORS: This is a warning log message. %s is the directory path.
764 _("The environment variable TMP refers to a directory that does not exist: %s"), localtmp)
765 localtmp = None
766 for drive in bleachbit.Windows.get_fixed_drives():
767 if localtmp and same_partition(localtmp, drive):
768 ret.append(localtmp)
769 else:
770 ret.append(drive)
771 else:
772 raise NotImplementedError('Unsupported OS in guess_overwrite_paths')
773 return ret
774
775
776def human_to_bytes(human, hformat='si'):

Callers 2

restoreMethod · 0.90

Calls 1

same_partitionFunction · 0.85

Tested by 1