Exemple #1
0
    def MakeShortcut(self, option):
        prm = ""
        dir = ""
        if option["type"] == "shortcut":
            prm = option["parameter"]
            dir = option["directory"]
        target = self.GetFocusedElement().fullpath
        dest = option["destination"]
        if not os.path.isabs(dest):  # 早退の場合は絶対に直す
            dest = os.path.normpath(os.path.join(os.path.dirname(target),
                                                 dest))

        # シンボリックリンクはNTFSにしか作成できない
        if option["type"] == "symbolicLink":
            tmp = misc.GetRootObject(dest)
            if (not tmp) or not isinstance(
                    fileSystemManager.GetFileSystemObject(tmp.fullpath),
                    fileSystemManager.NTFS):
                dialog(_("エラー"), _("NTFSドライブ以外の場所にシンボリックリンクを作成することはできません。"))
                return False

        # ハードリンクの場合、同一ドライブ上への作成に限られる
        # ネットワーク上の項目への作成はここにくる以前でブロック済み
        if option["type"] == "hardLink":
            if target[0] != dest[0]:  # 異なるドライブへの作成
                dialog(_("エラー"), _("他のドライブに対してハードリンクを作成することはできません。"))
                return False

        if option["type"] == "shortcut":
            inst = {
                "operation": option["type"],
                "target": [(dest, target, prm, dir, option["linkType"] == 1)]
            }
        else:
            inst = {
                "operation": option["type"],
                "from": [target],
                "to": [dest],
                "relative": option["linkType"]
            }
        # end ショートカットかそれ以外
        op = fileOperator.FileOperator(inst)
        ret = op.Execute()
        if op.CheckSucceeded() == 0:
            dialog(_("エラー"), _("ショートカットの作成に失敗しました。"))
            return False
        # end error
        self.UpdateFilelist(silence=True)
        return True
Exemple #2
0
 def GetRootObject(self):
     """ドライブ詳細情報表示で用いる"""
     return misc.GetRootObject(self.listObject.rootDirectory)
Exemple #3
0
 def GetRootDrivePath(self):
     return misc.GetRootObject(self.fullpath).fullpath