mirror of https://gitee.com/godoos/godoos.git
18 changed files with 1141 additions and 132 deletions
@ -0,0 +1,589 @@ |
|||
{ |
|||
"updatetime": "2024-08-24T10:42:22.086Z", |
|||
"apps": [ |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 32, |
|||
"mtime": "2024-08-24T10:42:22.086Z", |
|||
"atime": "2024-08-24T10:42:22.086Z", |
|||
"birthtime": "2024-08-24T10:42:22.086Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "computer.exe", |
|||
"path": "/C/Users/Desktop/computer.exe", |
|||
"oldPath": "/C/Users/Desktop/computer.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::computer::diannao", |
|||
"ext": "exe", |
|||
"title": "computer", |
|||
"isSys": 1, |
|||
"id": 28 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 30, |
|||
"mtime": "2024-08-24T10:42:22.095Z", |
|||
"atime": "2024-08-24T10:42:22.095Z", |
|||
"birthtime": "2024-08-24T10:42:22.095Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "appstore.exe", |
|||
"path": "/C/Users/Desktop/appstore.exe", |
|||
"oldPath": "/C/Users/Desktop/appstore.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::appstore::store", |
|||
"ext": "exe", |
|||
"title": "appstore", |
|||
"isSys": 1, |
|||
"id": 31 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 29, |
|||
"mtime": "2024-08-24T10:42:22.101Z", |
|||
"atime": "2024-08-24T10:42:22.101Z", |
|||
"birthtime": "2024-08-24T10:42:22.101Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "document.exe", |
|||
"path": "/C/Users/Desktop/document.exe", |
|||
"oldPath": "/C/Users/Desktop/document.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::document::word", |
|||
"ext": "exe", |
|||
"title": "document", |
|||
"isSys": 1, |
|||
"id": 38 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 27, |
|||
"mtime": "2024-08-24T10:42:22.102Z", |
|||
"atime": "2024-08-24T10:42:22.102Z", |
|||
"birthtime": "2024-08-24T10:42:22.102Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "excel.exe", |
|||
"path": "/C/Users/Desktop/excel.exe", |
|||
"oldPath": "/C/Users/Desktop/excel.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::excel::excel", |
|||
"ext": "exe", |
|||
"title": "excel", |
|||
"isSys": 1, |
|||
"id": 39 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 33, |
|||
"mtime": "2024-08-24T10:42:22.102Z", |
|||
"atime": "2024-08-24T10:42:22.102Z", |
|||
"birthtime": "2024-08-24T10:42:22.102Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "markdown.exe", |
|||
"path": "/C/Users/Desktop/markdown.exe", |
|||
"oldPath": "/C/Users/Desktop/markdown.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::markdown::markdown", |
|||
"ext": "exe", |
|||
"title": "markdown", |
|||
"isSys": 1, |
|||
"id": 40 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 31, |
|||
"mtime": "2024-08-24T10:42:22.104Z", |
|||
"atime": "2024-08-24T10:42:22.104Z", |
|||
"birthtime": "2024-08-24T10:42:22.104Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "mindmap.exe", |
|||
"path": "/C/Users/Desktop/mindmap.exe", |
|||
"oldPath": "/C/Users/Desktop/mindmap.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::mindmap::mindexe", |
|||
"ext": "exe", |
|||
"title": "mindmap", |
|||
"isSys": 1, |
|||
"id": 41 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 26, |
|||
"mtime": "2024-08-24T10:42:22.105Z", |
|||
"atime": "2024-08-24T10:42:22.105Z", |
|||
"birthtime": "2024-08-24T10:42:22.105Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "ppt.exe", |
|||
"path": "/C/Users/Desktop/ppt.exe", |
|||
"oldPath": "/C/Users/Desktop/ppt.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::ppt::pptexe", |
|||
"ext": "exe", |
|||
"title": "ppt", |
|||
"isSys": 1, |
|||
"id": 42 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 35, |
|||
"mtime": "2024-08-24T10:42:22.105Z", |
|||
"atime": "2024-08-24T10:42:22.105Z", |
|||
"birthtime": "2024-08-24T10:42:22.105Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "fileEditor.exe", |
|||
"path": "/C/Users/Desktop/fileEditor.exe", |
|||
"oldPath": "/C/Users/Desktop/fileEditor.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::fileEditor::editorbt", |
|||
"ext": "exe", |
|||
"title": "fileEditor", |
|||
"isSys": 1, |
|||
"id": 43 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 28, |
|||
"mtime": "2024-08-24T10:42:22.105Z", |
|||
"atime": "2024-08-24T10:42:22.105Z", |
|||
"birthtime": "2024-08-24T10:42:22.105Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "board.exe", |
|||
"path": "/C/Users/Desktop/board.exe", |
|||
"oldPath": "/C/Users/Desktop/board.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::board::kanban", |
|||
"ext": "exe", |
|||
"title": "board", |
|||
"isSys": 1, |
|||
"id": 44 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 33, |
|||
"mtime": "2024-08-24T10:42:22.106Z", |
|||
"atime": "2024-08-24T10:42:22.106Z", |
|||
"birthtime": "2024-08-24T10:42:22.106Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "whiteBoard.exe", |
|||
"path": "/C/Users/Desktop/whiteBoard.exe", |
|||
"oldPath": "/C/Users/Desktop/whiteBoard.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::whiteBoard::baiban", |
|||
"ext": "exe", |
|||
"title": "whiteBoard", |
|||
"isSys": 1, |
|||
"id": 45 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 30, |
|||
"mtime": "2024-08-24T10:42:22.107Z", |
|||
"atime": "2024-08-24T10:42:22.107Z", |
|||
"birthtime": "2024-08-24T10:42:22.107Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "localchat.exe", |
|||
"path": "/C/Users/Desktop/localchat.exe", |
|||
"oldPath": "/C/Users/Desktop/localchat.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::localchat::chat", |
|||
"ext": "exe", |
|||
"title": "localchat", |
|||
"isSys": 1, |
|||
"id": 46 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 33, |
|||
"mtime": "2024-08-24T10:42:22.108Z", |
|||
"atime": "2024-08-24T10:42:22.108Z", |
|||
"birthtime": "2024-08-24T10:42:22.108Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "piceditor.exe", |
|||
"path": "/C/Users/Desktop/piceditor.exe", |
|||
"oldPath": "/C/Users/Desktop/piceditor.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::piceditor::picedit", |
|||
"ext": "exe", |
|||
"title": "piceditor", |
|||
"isSys": 1, |
|||
"id": 47 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 26, |
|||
"mtime": "2024-08-24T10:42:22.109Z", |
|||
"atime": "2024-08-24T10:42:22.109Z", |
|||
"birthtime": "2024-08-24T10:42:22.109Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "gantt.exe", |
|||
"path": "/C/Users/Desktop/gantt.exe", |
|||
"oldPath": "/C/Users/Desktop/gantt.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::gantt::gant", |
|||
"ext": "exe", |
|||
"title": "gantt", |
|||
"isSys": 1, |
|||
"id": 48 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 30, |
|||
"mtime": "2024-08-24T10:42:22.112Z", |
|||
"atime": "2024-08-24T10:42:22.112Z", |
|||
"birthtime": "2024-08-24T10:42:22.112Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "browser.exe", |
|||
"path": "/C/Users/Desktop/browser.exe", |
|||
"oldPath": "/C/Users/Desktop/browser.exe", |
|||
"parentPath": "/C/Users/Desktop", |
|||
"content": "link::Desktop::browser::brower", |
|||
"ext": "exe", |
|||
"title": "browser", |
|||
"isSys": 1, |
|||
"id": 53 |
|||
} |
|||
], |
|||
"magnet": [ |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 30, |
|||
"mtime": "2024-08-24T10:42:22.083Z", |
|||
"atime": "2024-08-24T10:42:22.083Z", |
|||
"birthtime": "2024-08-24T10:42:22.083Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "setting.exe", |
|||
"path": "/C/Users/Magnet/setting.exe", |
|||
"oldPath": "/C/Users/Magnet/setting.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::setting::setting", |
|||
"ext": "exe", |
|||
"title": "setting", |
|||
"isSys": 1, |
|||
"id": 26 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 31, |
|||
"mtime": "2024-08-24T10:42:22.090Z", |
|||
"atime": "2024-08-24T10:42:22.090Z", |
|||
"birthtime": "2024-08-24T10:42:22.090Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "computer.exe", |
|||
"path": "/C/Users/Magnet/computer.exe", |
|||
"oldPath": "/C/Users/Magnet/computer.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::computer::diannao", |
|||
"ext": "exe", |
|||
"title": "computer", |
|||
"isSys": 1, |
|||
"id": 29 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 29, |
|||
"mtime": "2024-08-24T10:42:22.096Z", |
|||
"atime": "2024-08-24T10:42:22.096Z", |
|||
"birthtime": "2024-08-24T10:42:22.096Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "appstore.exe", |
|||
"path": "/C/Users/Magnet/appstore.exe", |
|||
"oldPath": "/C/Users/Magnet/appstore.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::appstore::store", |
|||
"ext": "exe", |
|||
"title": "appstore", |
|||
"isSys": 1, |
|||
"id": 32 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 34, |
|||
"mtime": "2024-08-24T10:42:22.097Z", |
|||
"atime": "2024-08-24T10:42:22.097Z", |
|||
"birthtime": "2024-08-24T10:42:22.097Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "system.version.exe", |
|||
"path": "/C/Users/Magnet/system.version.exe", |
|||
"oldPath": "/C/Users/Magnet/system.version.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::system.version::info", |
|||
"ext": "exe", |
|||
"title": "system.version", |
|||
"isSys": 1, |
|||
"id": 34 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 37, |
|||
"mtime": "2024-08-24T10:42:22.099Z", |
|||
"atime": "2024-08-24T10:42:22.099Z", |
|||
"birthtime": "2024-08-24T10:42:22.099Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "process.title.exe", |
|||
"path": "/C/Users/Magnet/process.title.exe", |
|||
"oldPath": "/C/Users/Magnet/process.title.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::process.title::progress", |
|||
"ext": "exe", |
|||
"title": "process.title", |
|||
"isSys": 1, |
|||
"id": 36 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 36, |
|||
"mtime": "2024-08-24T10:42:22.110Z", |
|||
"atime": "2024-08-24T10:42:22.110Z", |
|||
"birthtime": "2024-08-24T10:42:22.110Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "calculator.exe", |
|||
"path": "/C/Users/Magnet/calculator.exe", |
|||
"oldPath": "/C/Users/Magnet/calculator.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::calculator::calculator", |
|||
"ext": "exe", |
|||
"title": "calculator", |
|||
"isSys": 1, |
|||
"id": 49 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 32, |
|||
"mtime": "2024-08-24T10:42:22.111Z", |
|||
"atime": "2024-08-24T10:42:22.111Z", |
|||
"birthtime": "2024-08-24T10:42:22.111Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "calendar.exe", |
|||
"path": "/C/Users/Magnet/calendar.exe", |
|||
"oldPath": "/C/Users/Magnet/calendar.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::calendar::calendar", |
|||
"ext": "exe", |
|||
"title": "calendar", |
|||
"isSys": 1, |
|||
"id": 50 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 31, |
|||
"mtime": "2024-08-24T10:42:22.111Z", |
|||
"atime": "2024-08-24T10:42:22.111Z", |
|||
"birthtime": "2024-08-24T10:42:22.111Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "musicStore.exe", |
|||
"path": "/C/Users/Magnet/musicStore.exe", |
|||
"oldPath": "/C/Users/Magnet/musicStore.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::musicStore::music", |
|||
"ext": "exe", |
|||
"title": "musicStore", |
|||
"isSys": 1, |
|||
"id": 51 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 30, |
|||
"mtime": "2024-08-24T10:42:22.112Z", |
|||
"atime": "2024-08-24T10:42:22.112Z", |
|||
"birthtime": "2024-08-24T10:42:22.112Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "gallery.exe", |
|||
"path": "/C/Users/Magnet/gallery.exe", |
|||
"oldPath": "/C/Users/Magnet/gallery.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::gallery::gallery", |
|||
"ext": "exe", |
|||
"title": "gallery", |
|||
"isSys": 1, |
|||
"id": 52 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 29, |
|||
"mtime": "2024-08-24T10:42:22.113Z", |
|||
"atime": "2024-08-24T10:42:22.113Z", |
|||
"birthtime": "2024-08-24T10:42:22.113Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "browser.exe", |
|||
"path": "/C/Users/Magnet/browser.exe", |
|||
"oldPath": "/C/Users/Magnet/browser.exe", |
|||
"parentPath": "/C/Users/Magnet", |
|||
"content": "link::Magnet::browser::brower", |
|||
"ext": "exe", |
|||
"title": "browser", |
|||
"isSys": 1, |
|||
"id": 54 |
|||
} |
|||
], |
|||
"menulist": [ |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 32, |
|||
"mtime": "2024-08-24T10:42:22.085Z", |
|||
"atime": "2024-08-24T10:42:22.085Z", |
|||
"birthtime": "2024-08-24T10:42:22.085Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "setting.exe", |
|||
"path": "/C/Users/Menulist/setting.exe", |
|||
"oldPath": "/C/Users/Menulist/setting.exe", |
|||
"parentPath": "/C/Users/Menulist", |
|||
"content": "link::Menulist::setting::setting", |
|||
"ext": "exe", |
|||
"title": "setting", |
|||
"isSys": 1, |
|||
"id": 27 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 33, |
|||
"mtime": "2024-08-24T10:42:22.094Z", |
|||
"atime": "2024-08-24T10:42:22.094Z", |
|||
"birthtime": "2024-08-24T10:42:22.094Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "computer.exe", |
|||
"path": "/C/Users/Menulist/computer.exe", |
|||
"oldPath": "/C/Users/Menulist/computer.exe", |
|||
"parentPath": "/C/Users/Menulist", |
|||
"content": "link::Menulist::computer::diannao", |
|||
"ext": "exe", |
|||
"title": "computer", |
|||
"isSys": 1, |
|||
"id": 30 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 31, |
|||
"mtime": "2024-08-24T10:42:22.096Z", |
|||
"atime": "2024-08-24T10:42:22.096Z", |
|||
"birthtime": "2024-08-24T10:42:22.096Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "appstore.exe", |
|||
"path": "/C/Users/Menulist/appstore.exe", |
|||
"oldPath": "/C/Users/Menulist/appstore.exe", |
|||
"parentPath": "/C/Users/Menulist", |
|||
"content": "link::Menulist::appstore::store", |
|||
"ext": "exe", |
|||
"title": "appstore", |
|||
"isSys": 1, |
|||
"id": 33 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 36, |
|||
"mtime": "2024-08-24T10:42:22.098Z", |
|||
"atime": "2024-08-24T10:42:22.098Z", |
|||
"birthtime": "2024-08-24T10:42:22.098Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "system.version.exe", |
|||
"path": "/C/Users/Menulist/system.version.exe", |
|||
"oldPath": "/C/Users/Menulist/system.version.exe", |
|||
"parentPath": "/C/Users/Menulist", |
|||
"content": "link::Menulist::system.version::info", |
|||
"ext": "exe", |
|||
"title": "system.version", |
|||
"isSys": 1, |
|||
"id": 35 |
|||
}, |
|||
{ |
|||
"isFile": true, |
|||
"isDirectory": false, |
|||
"isSymlink": false, |
|||
"size": 39, |
|||
"mtime": "2024-08-24T10:42:22.100Z", |
|||
"atime": "2024-08-24T10:42:22.100Z", |
|||
"birthtime": "2024-08-24T10:42:22.100Z", |
|||
"mode": 511, |
|||
"rdev": 0, |
|||
"name": "process.title.exe", |
|||
"path": "/C/Users/Menulist/process.title.exe", |
|||
"oldPath": "/C/Users/Menulist/process.title.exe", |
|||
"parentPath": "/C/Users/Menulist", |
|||
"content": "link::Menulist::process.title::progress", |
|||
"ext": "exe", |
|||
"title": "process.title", |
|||
"isSys": 1, |
|||
"id": 37 |
|||
} |
|||
] |
|||
} |
@ -0,0 +1,126 @@ |
|||
package files |
|||
|
|||
import ( |
|||
"strings" |
|||
"time" |
|||
) |
|||
|
|||
type AppInfo struct { |
|||
Name string `json:"name"` |
|||
Path string `json:"path"` |
|||
OldPath string `json:"oldPath"` |
|||
ParentPath string `json:"parentPath"` |
|||
Content string `json:"content"` |
|||
Ext string `json:"ext"` |
|||
Title string `json:"title"` |
|||
IsSys int `json:"isSys"` |
|||
ID int `json:"id"` |
|||
IsFile bool `json:"isFile"` |
|||
IsDirectory bool `json:"isDirectory"` |
|||
IsSymlink bool `json:"isSymlink"` |
|||
Size int `json:"size"` |
|||
Mtime time.Time `json:"mtime"` // Modified time
|
|||
Atime time.Time `json:"atime"` // Access time
|
|||
Birthtime time.Time `json:"birthtime"` // Creation time
|
|||
Mode int `json:"mode"` |
|||
Rdev int `json:"rdev"` |
|||
} |
|||
|
|||
// RootObject represents the root object in the JSON data.
|
|||
type RootObject struct { |
|||
UpdateTime time.Time `json:"updatetime"` |
|||
Desktop []AppInfo `json:"apps"` |
|||
Menulist []AppInfo `json:"menulist"` |
|||
} |
|||
|
|||
var RootAppList = []map[string]string{ |
|||
{"name": "computer", "icon": "diannao", "position": "Desktop,Menulist"}, |
|||
{"name": "appstore", "icon": "store", "position": "Desktop,Menulist"}, |
|||
{"name": "localchat", "icon": "chat", "position": "Desktop"}, |
|||
{"name": "document", "icon": "word", "position": "Desktop"}, |
|||
{"name": "excel", "icon": "excel", "position": "Desktop"}, |
|||
{"name": "markdown", "icon": "markdown", "position": "Desktop"}, |
|||
{"name": "mindmap", "icon": "mindexe", "position": "Desktop"}, |
|||
{"name": "ppt", "icon": "pptexe", "position": "Desktop"}, |
|||
{"name": "fileEditor", "icon": "editorbt", "position": "Desktop"}, |
|||
{"name": "board", "icon": "kanban", "position": "Desktop"}, |
|||
{"name": "whiteBoard", "icon": "baiban", "position": "Desktop"}, |
|||
{"name": "piceditor", "icon": "picedit", "position": "Desktop"}, |
|||
{"name": "gantt", "icon": "gant", "position": "Desktop"}, |
|||
{"name": "browser", "icon": "brower", "position": "Desktop,Menulist"}, |
|||
{"name": "setting", "icon": "setting", "position": "Menulist"}, |
|||
{"name": "system.version", "icon": "info", "position": "Menulist"}, |
|||
{"name": "process.title", "icon": "progress", "position": "Menulist"}, |
|||
{"name": "calculator", "icon": "calculator", "position": "Menulist"}, |
|||
{"name": "calendar", "icon": "calendar", "position": "Menulist"}, |
|||
{"name": "musicStore", "icon": "music", "position": "Menulist"}, |
|||
{"name": "gallery", "icon": "gallery", "position": "Menulist"}, |
|||
{"name": "process.title", "icon": "progress", "position": "Menulist"}, |
|||
} |
|||
|
|||
// GetInitRootList constructs the initial root list.
|
|||
func GetInitRootList() RootObject { |
|||
var desktopApps []AppInfo |
|||
var menulistApps []AppInfo |
|||
nowtime := time.Now() |
|||
var id = 1 |
|||
for _, app := range RootAppList { |
|||
positions := strings.Split(app["position"], ",") |
|||
content := "link::Desktop::" + app["name"] + "::" + app["icon"] |
|||
for _, pos := range positions { |
|||
switch pos { |
|||
case "Desktop": |
|||
newApp := AppInfo{ |
|||
Name: app["name"] + ".exe", |
|||
Path: "/C/Users/Desktop/" + app["name"] + ".exe", |
|||
OldPath: "/C/Users/Desktop/" + app["name"] + ".exe", |
|||
ParentPath: "/C/Users/Desktop", |
|||
Content: content, |
|||
Ext: "exe", |
|||
Title: app["name"], |
|||
IsSys: 1, |
|||
ID: id, |
|||
IsFile: true, |
|||
IsDirectory: false, |
|||
IsSymlink: false, |
|||
Size: len(content), // Size can be set to any value
|
|||
Mtime: nowtime, |
|||
Atime: nowtime, |
|||
Birthtime: nowtime, |
|||
Mode: 511, |
|||
Rdev: 0, |
|||
} |
|||
desktopApps = append(desktopApps, newApp) |
|||
case "Menulist": |
|||
newApp := AppInfo{ |
|||
Name: app["name"] + ".exe", |
|||
Path: "/C/Users/Menulist/" + app["name"] + ".exe", |
|||
OldPath: "/C/Users/Menulist/" + app["name"] + ".exe", |
|||
ParentPath: "/C/Users/Menulist", |
|||
Content: content, |
|||
Ext: "exe", |
|||
Title: app["name"], |
|||
IsSys: 1, |
|||
ID: id, |
|||
IsFile: true, |
|||
IsDirectory: false, |
|||
IsSymlink: false, |
|||
Size: len(content), |
|||
Mtime: nowtime, |
|||
Atime: nowtime, |
|||
Birthtime: nowtime, |
|||
Mode: 511, |
|||
Rdev: 0, |
|||
} |
|||
menulistApps = append(menulistApps, newApp) |
|||
} |
|||
} |
|||
id++ |
|||
} |
|||
|
|||
return RootObject{ |
|||
UpdateTime: nowtime, |
|||
Desktop: desktopApps, |
|||
Menulist: menulistApps, |
|||
} |
|||
} |
@ -0,0 +1,231 @@ |
|||
package files |
|||
|
|||
import ( |
|||
"encoding/json" |
|||
"fmt" |
|||
"godo/libs" |
|||
"os" |
|||
"path/filepath" |
|||
"time" |
|||
) |
|||
|
|||
func RecoverOsSystem() error { |
|||
basePath, err := libs.GetOsDir() |
|||
if err != nil { |
|||
return fmt.Errorf("GetOsDir error: %v", err) |
|||
} |
|||
|
|||
osCpath := filepath.Join(basePath, "C") |
|||
if libs.PathExists(osCpath) { |
|||
err := os.RemoveAll(osCpath) |
|||
if err != nil { |
|||
return fmt.Errorf("RemoveAll error: %v", err) |
|||
} |
|||
} |
|||
err = InitOsSystem() |
|||
if err != nil { |
|||
return fmt.Errorf("InitOsSystem error: %v", err) |
|||
} |
|||
return nil |
|||
} |
|||
func InitOsSystem() error { |
|||
basePath, err := libs.GetOsDir() |
|||
if err != nil { |
|||
return fmt.Errorf("GetOsDir error: %v", err) |
|||
} |
|||
if !libs.PathExists(basePath) { |
|||
if err := os.MkdirAll(basePath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
} |
|||
osCpath := filepath.Join(basePath, "C") |
|||
if !libs.PathExists(osCpath) { |
|||
if err := os.MkdirAll(osCpath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
baseOsDir := []string{ |
|||
"D", |
|||
"E", |
|||
"B", |
|||
} |
|||
for _, dir := range baseOsDir { |
|||
dirPath := filepath.Join(basePath, dir) |
|||
if !libs.PathExists(dirPath) { |
|||
if err := os.MkdirAll(dirPath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
} |
|||
} |
|||
systemPath := filepath.Join(osCpath, "System") |
|||
if !libs.PathExists(systemPath) { |
|||
if err := os.MkdirAll(systemPath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
} |
|||
userPath := filepath.Join(osCpath, "Users") |
|||
if !libs.PathExists(userPath) { |
|||
if err := os.MkdirAll(userPath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
InitPaths := []string{ |
|||
"Desktop", |
|||
"Menulist", |
|||
"Documents", |
|||
"Downloads", |
|||
"Music", |
|||
"Pictures", |
|||
"Videos", |
|||
"Schedule", |
|||
"Reciv", |
|||
} |
|||
for _, dir := range InitPaths { |
|||
dirPath := filepath.Join(userPath, dir) |
|||
if !libs.PathExists(dirPath) { |
|||
if err := os.MkdirAll(dirPath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
} |
|||
} |
|||
InitDocPath := []string{ |
|||
"Word", |
|||
"Markdown", |
|||
"PPT", |
|||
"Baiban", |
|||
"Kanban", |
|||
"Execl", |
|||
"Mind", |
|||
"Screenshot", |
|||
"ScreenRecording", |
|||
} |
|||
docpath := filepath.Join(userPath, "Documents") |
|||
for _, dir := range InitDocPath { |
|||
dirPath := filepath.Join(docpath, dir) |
|||
if !libs.PathExists(dirPath) { |
|||
if err := os.MkdirAll(dirPath, 0755); err != nil { |
|||
return fmt.Errorf("Mkdir error: %v", err) |
|||
} |
|||
} |
|||
} |
|||
|
|||
applist := GetInitRootList() |
|||
desktopPath := filepath.Join(userPath, "Desktop") |
|||
for _, app := range applist.Desktop { |
|||
appPath := filepath.Join(desktopPath, app.Name) |
|||
if !libs.PathExists(appPath) { |
|||
if err := os.WriteFile(appPath, []byte(app.Content), 0644); err != nil { |
|||
return fmt.Errorf("failed to write to file: %w", err) |
|||
} |
|||
} |
|||
} |
|||
menulistPath := filepath.Join(userPath, "Menulist") |
|||
for _, app := range applist.Menulist { |
|||
appPath := filepath.Join(menulistPath, app.Name) |
|||
if !libs.PathExists(appPath) { |
|||
if err := os.WriteFile(appPath, []byte(app.Content), 0644); err != nil { |
|||
return fmt.Errorf("failed to write to file: %w", err) |
|||
} |
|||
} |
|||
} |
|||
content, err := json.MarshalIndent(applist, "", " ") |
|||
if err != nil { |
|||
return fmt.Errorf("failed to marshal reqBodies to JSON: %w", err) |
|||
} |
|||
appPath, err := libs.GetAppDir() |
|||
if err != nil { |
|||
return fmt.Errorf("GetAppDir error: %v", err) |
|||
} |
|||
desktopFilePath := filepath.Join(appPath, "desktop.json") |
|||
if err := os.WriteFile(desktopFilePath, content, 0644); err != nil { |
|||
return fmt.Errorf("failed to write to file: %w", err) |
|||
} |
|||
} |
|||
|
|||
} |
|||
|
|||
return nil |
|||
} |
|||
func GetDesktop() (RootObject, error) { |
|||
var applist RootObject |
|||
desktoppath, err := GetDeskTopPath() |
|||
if err != nil || !libs.PathExists(desktoppath) { |
|||
return applist, fmt.Errorf("desktop.json not found") |
|||
|
|||
} |
|||
content, err := os.ReadFile(desktoppath) |
|||
if err != nil { |
|||
return applist, fmt.Errorf("failed to read file: %w", err) |
|||
} |
|||
|
|||
err = json.Unmarshal(content, &applist) |
|||
if err != nil { |
|||
return applist, fmt.Errorf("failed to unmarshal JSON: %w", err) |
|||
} |
|||
return applist, nil |
|||
} |
|||
func GetDeskTopPath() (string, error) { |
|||
appPath, err := libs.GetAppDir() |
|||
if err != nil { |
|||
return "", fmt.Errorf("GetAppDir error: %v", err) |
|||
} |
|||
return filepath.Join(appPath, "desktop.json"), nil |
|||
} |
|||
func WriteDesktop(rootInfo RootObject) error { |
|||
rootInfo.UpdateTime = time.Now() |
|||
content, err := json.MarshalIndent(rootInfo, "", " ") |
|||
if err != nil { |
|||
return fmt.Errorf("failed to marshal reqBodies to JSON: %w", err) |
|||
} |
|||
basePath, err := libs.GetOsDir() |
|||
if err != nil { |
|||
return fmt.Errorf("GetOsDir error: %v", err) |
|||
} |
|||
desktoppath := filepath.Join(basePath, "C", "System", "desktop.json") |
|||
return os.WriteFile(desktoppath, content, 0644) |
|||
} |
|||
func AddDesktop(app AppInfo, position string) error { |
|||
applist, err := GetDesktop() |
|||
if err != nil { |
|||
return fmt.Errorf("GetDesktop error: %v", err) |
|||
} |
|||
if position == "Desktop" { |
|||
if !checkHasApp(applist.Desktop, app) { |
|||
applist.Desktop = append(applist.Desktop, app) |
|||
} |
|||
} else if position == "Menulist" { |
|||
if !checkHasApp(applist.Menulist, app) { |
|||
applist.Menulist = append(applist.Menulist, app) |
|||
} |
|||
} else { |
|||
return fmt.Errorf("position error") |
|||
} |
|||
return WriteDesktop(applist) |
|||
} |
|||
func DeleteDesktop(name string) error { |
|||
rootInfo, err := GetDesktop() |
|||
if err != nil { |
|||
return fmt.Errorf("GetDesktop error: %v", err) |
|||
} |
|||
indexToDelete := -1 |
|||
for i, item := range rootInfo.Desktop { |
|||
if item.Name == name { |
|||
indexToDelete = i |
|||
break |
|||
} |
|||
} |
|||
// 如果找到了要删除的元素
|
|||
if indexToDelete >= 0 { |
|||
// 使用 append 删除元素
|
|||
rootInfo.Desktop = append(rootInfo.Desktop[:indexToDelete], rootInfo.Desktop[indexToDelete+1:]...) |
|||
} else { |
|||
return fmt.Errorf("item with name '%s' not found", name) |
|||
} |
|||
return WriteDesktop(rootInfo) |
|||
} |
|||
func checkHasApp(list []AppInfo, app AppInfo) bool { |
|||
for _, item := range list { |
|||
if item.Name == app.Name { |
|||
return true |
|||
} |
|||
} |
|||
return false |
|||
} |
Loading…
Reference in new issue