Skip to content

Instantly share code, notes, and snippets.

@yakumo-proj
Created November 16, 2021 12:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yakumo-proj/e56cbb0445365e6c187cdebdd3a44a82 to your computer and use it in GitHub Desktop.
Save yakumo-proj/e56cbb0445365e6c187cdebdd3a44a82 to your computer and use it in GitHub Desktop.
VRoidカスタムアイテムインストーラ
require 'json'
require 'fileutils'
base_dir = Dir.home + '/Library/Containers/net.pixiv.vroid.macosx/Data' +
'/Library/Application Support/net.pixiv.vroid.macosx/custom_items/'
folders = readlines.map(&:chomp).map {|filename|
j = `unzip -p #{filename} v1customitem/meta.json`
objs = JSON.parse(j)
dest_path = base_dir + 'N00-' + objs['rootTransferableGroupTypeId'].split('.').last
FileUtils.mkdir_p(dest_path)
FileUtils.move(filename, dest_path)
dest_path
}.uniq
puts folders.empty? ? base_dir : folders
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment