Mounts a share at the specified path

    Args:
        share_path: String URL with all auth info to connect to file share.
        mount_path: Path to mount share on.

    Returns:
        The mount point or raises an error
351718
def mount_share_at_path(share_path, mount_path):
    
    sh_url = CFURLCreateWithString(None, share_path, None)
    mo_url = CFURLCreateWithString(None, mount_path, None)
    # Set UI to reduced interaction
    open_options = {NetFS.kNAUIOptionKey: NetFS.kNAUIOptionNoUI}
    # Allow mounting sub-directories of root shares
    # Also specify the share should be mounted directly at (not under)
    # mount_path
    mount_options = {NetFS.kNetFSAllowSubMountsKey: True,
                     NetFS.kNetFSMountAtMountDirKey: True}
    # Mount!
    result, output = NetFS.NetFSMountURLSync(sh_url, mo_url, None, None,
                                             open_options, mount_options, None)
    # Check if it worked
    if result != 0:
        raise Exception('Error mounting url "%s" at path "%s": %s' %
                        (share_path, mount_path, output))
    # Return the mountpath
    return str(output[0])
413009
def set_root_path!
       raise 'APP_ROOT is not set' unless defined?(::APP_ROOT)
       raise 'APP_ROOT is not a directory' unless File.directory?(::APP_ROOT)

       @root_path =
         # Pathname is incompatible with Windows, but Windows doesn't have
         # real symlinks so File.expand_path is safe.
         if RUBY_PLATFORM =~ /(:?mswin|mingw)/
           File.expand_path(::APP_ROOT)

         # Otherwise use Pathname#realpath which respects symlinks.
         else
           Pathname.new(::APP_ROOT).realpath.to_s
         end

       Object.const_set(:RELATIVE_APP_ROOT, ::APP_ROOT.dup) unless defined?(::RELATIVE_APP_ROOT)
       ::APP_ROOT.replace @root_path
     end
394019
def local_path(path):
    
    current = os.path.dirname(__file__)
    root = current
    return os.path.abspath(os.path.join(root, path))
1267189
def mount(self, app, script_path):
        '''  '''
        if not isinstance(app, Bottle):
            raise TypeError('Only Bottle instances are supported for now.')
        script_path = '/'.join(filter(None, script_path.split('/')))
        path_depth = script_path.count('/') + 1
        if not script_path:
            raise TypeError('Empty script_path. Perhaps you want a merge()?')
        for other in self.mounts:
            if other.startswith(script_path):
                raise TypeError('Conflict with existing mount: %s' % other)
        @self.route('/%s/:#.*#' % script_path, method="ANY")
        def mountpoint():
            request.path_shift(path_depth)
            return app.handle(request.path, request.method)
        self.mounts[script_path] = app
811492
def load(self, path):
        
        path = os.path.expandvars(os.path.expanduser(path))

        gdg = cgaddag.gdg_load(path.encode("ascii"))
        if not gdg:
            errno = ctypes.c_int.in_dll(ctypes.pythonapi, "errno").value
            raise OSError(errno, os.strerror(errno), path)

        self.__del__()
        self.gdg = gdg.contents
17740
def send_dir(self, local_path, remote_path, user='root'):
        
        self.enable_user(user)
        return self.ssh_pool.send_dir(user, local_path, remote_path)
743973
def url_for(path, opts = {})
      path = absolute(path)
      (opts[:expires] ? storage.media(path) : storage.shares(path))['url']
    end
718707
def child(self, path):
        
        if self._shareID is not None:
            self = url.URL.child(self, self._shareID)
            self._shareID = None
        return url.URL.child(self, path)
530760
def register_share_command(self, share_func):
        
        description = "Share a project with another user with specified  permissions. " \
                      "Sends the other user an email message via D4S2 service. " \
                      "If not specified this command gives user download permissions."
        share_parser = self.subparsers.add_parser('share', description=description)
        add_project_name_or_id_arg(share_parser)
        user_or_email = share_parser.add_mutually_exclusive_group(required=True)
        add_user_arg(user_or_email)
        add_email_arg(user_or_email)
        _add_auth_role_arg(share_parser, default_permissions='file_downloader')
        _add_resend_arg(share_parser, "Resend share")
        _add_message_file(share_parser, "Filename containing a message to be sent with the share. "
                                        "Pass - to read from stdin.")
        share_parser.set_defaults(func=share_func)
38479
def set_relative_path(self, common_prefix, base_dir):
        
        self.short_filename = self.filename.replace(common_prefix, '', 1)
477271
def add_path_with_storage_account(self, remote_path, storage_account):
        # type: (SourcePath, str, str) -> None
        
        if len(self._path_map) >= 1:
            raise RuntimeError(
                'cannot add multiple remote paths to SourcePath objects')
        rpath = blobxfer.util.normalize_azure_path(remote_path)
        self.add_path(rpath)
        self._path_map[rpath] = storage_account
531963
def _assert_path_is_rw(self):
        
        if not self.path:
            raise ValueError("`path` argument must be set!")

        if not os.path.exists(self.path):
            raise IOError("`%s` not found." % self.path)

        if not os.path.isdir(self.path):
            raise IOError("`%s` is not a directory!" % self.path)

        if not os.access(self.path, (os.R_OK or os.W_OK)):
            raise IOError(
                "Can't access `%s`, please check permissions." % self.path
            )
1131942
def mount(self, url, app):
        ""
        # Inspired by Bottle. It might seem that dispatching to
        # subapps would rather be handled by normal routes, but
        # arguably, that's less efficient. Taking into account
        # that paradigmatically there's difference between handing
        # an action and delegating responisibilities to another
        # app, Bottle's way was followed.
        app.url = url
        self.mounts.append(app)
19213
def set_path (self, path):
        
        assert isinstance(path, basestring)
        self.path_ = os.path.normpath(path)
243806
def ensure_path_exists(dir_path):
    
    if not os.path.exists(dir_path):
        mkdir(dir_path)
        return True
    return False
1306162
def path(self, path: str):
        

        path = path if path else ''
        self.pathName = os.path.join(path, self.name)
257129
def mkdir(self, pathobj, _):
        
        if not pathobj.drive or not pathobj.root:
            raise RuntimeError("Full path required: '%s'" % str(pathobj))

        if pathobj.exists():
            raise OSError(17, "File exists: '%s'" % str(pathobj))

        url = str(pathobj) + '/'
        text, code = self.rest_put(url, session=pathobj.session, verify=pathobj.verify, cert=pathobj.cert)

        if not code == 201:
            raise RuntimeError("%s %d" % (text, code))