Ejemplo n.º 1
0
 def prepare(self):
     default_path, default_binary = os.path.split(
         self.parent.config.get_default_value("syncthing_binary"))
     self.paths = []
     if default_path:
         self.paths += [default_path]
     self.paths += ["./"]
     self.paths += [os.path.expanduser("~/.local/bin")]
     self.paths += [self.parent.st_configdir]
     if is_portable():
         self.paths += [".\\data"]
     if StDownloader is None:
         self.binaries = ["syncthing"]
     else:
         suffix, trash = StDownloader.determine_platform()
         self.binaries = ["syncthing", "syncthing%s" % (suffix, )]
         if suffix == "x64":
             # Allow 32bit binary on 64bit
             self.binaries += ["syncthing.x86"]
         if default_binary not in self.binaries:
             self.binaries = [default_binary] + self.binaries
     if IS_WINDOWS:
         self.paths += [
             "c:/Program Files/syncthing",
             "c:/Program Files (x86)/syncthing", self.parent.st_configdir
         ]
         self.binaries = ("syncthing.exe", )
     if "PATH" in os.environ:
         self.paths += os.environ["PATH"].split(":")
     log.info("Searching for syncthing binary...")
     GLib.idle_add(self.search)
Ejemplo n.º 2
0
	def prepare(self):
		default_path, default_binary = os.path.split(
				self.parent.config.get_default_value("syncthing_binary"))
		self.paths = []
		if default_path:
			self.paths += [ default_path ]
		self.paths += [ "./" ]
		self.paths += [ os.path.expanduser("~/.local/bin") ]
		self.paths += [ self.parent.st_configdir ]
		if is_portable():
			self.paths += [ ".\\data" ]
		if StDownloader is None:
			self.binaries = ["syncthing"]
		else:
			suffix, trash = StDownloader.determine_platform()
			self.binaries = ["syncthing", "syncthing%s" % (suffix,)]
			if suffix == "x64":
				# Allow 32bit binary on 64bit
				self.binaries += ["syncthing.x86"]
			if default_binary not in self.binaries:
				self.binaries = [ default_binary ] + self.binaries
		if IS_WINDOWS:
			self.paths += [ "c:/Program Files/syncthing",
				"c:/Program Files (x86)/syncthing",
				self.parent.st_configdir
				]
			self.binaries = ("syncthing.exe",)
		if "PATH" in os.environ:
			self.paths += os.environ["PATH"].split(":")
		log.info("Searching for syncthing binary...")
		GLib.idle_add(self.search)
Ejemplo n.º 3
0
    def get_target_folder(*a):
        """
		Returns target directory where Syncthing binary will
		be downloaded.
		That's %APPDATA%/syncthing on Windows or one of ~/bin, ~/.bin
		or ~/.local/bin, whatever already exists. If none of folders
		are existing on Linux, ~/.local/bin will be created.
		
		Path will contain ~ on Linux and needs to be expanded.
		"""
        if IS_WINDOWS:
            if is_portable():
                return ".\\data"
            return os.path.join(get_config_dir(), "syncthing")
        for p in ("~/bin", "~/.bin"):
            if os.path.exists(os.path.expanduser(p)):
                return p
        return "~/.local/bin"
Ejemplo n.º 4
0
	def get_target_folder(*a):
		"""
		Returns target directory where Syncthing binary will
		be downloaded.
		That's %APPDATA%/syncthing on Windows or one of ~/bin, ~/.bin
		or ~/.local/bin, whatever already exists. If none of folders
		are existing on Linux, ~/.local/bin will be created.
		
		Path will contain ~ on Linux and needs to be expanded.
		"""
		if IS_WINDOWS:
			if is_portable():
				return ".\\data"
			return os.path.join(get_config_dir(), "syncthing")
		for p in ("~/bin", "~/.bin"):
			if os.path.exists(os.path.expanduser(p)):
				return p
		return "~/.local/bin"
Ejemplo n.º 5
0
def Configuration(*a, **b):
    if IS_WINDOWS and not is_portable():
        from syncthing_gtk.windows import WinConfiguration
        return WinConfiguration(*a, **b)
    return _Configuration(*a, **b)