forked from rojo-rbx/rojo
Fix 'rojo upload' behavior
This commit is contained in:
@@ -155,10 +155,6 @@ pub struct UploadCommand {
|
||||
#[structopt(default_value = "")]
|
||||
pub project: PathBuf,
|
||||
|
||||
/// The kind of asset to generate, 'place', or 'model'. Defaults to place.
|
||||
#[structopt(long, default_value = "place")]
|
||||
pub kind: UploadKind,
|
||||
|
||||
/// Authenication cookie to use. If not specified, Rojo will attempt to find one from the system automatically.
|
||||
#[structopt(long)]
|
||||
pub cookie: Option<String>,
|
||||
|
||||
@@ -43,14 +43,23 @@ fn upload_inner(options: UploadCommand) -> Result<(), Error> {
|
||||
let vfs = Vfs::new(RealFetcher::new(WatchMode::Disabled));
|
||||
|
||||
let (_maybe_project, tree) = common_setup::start(&options.absolute_project(), &vfs);
|
||||
let root_id = tree.get_root_id();
|
||||
|
||||
let inner_tree = tree.inner();
|
||||
let root_id = inner_tree.get_root_id();
|
||||
let root_instance = inner_tree.get_instance(root_id).unwrap();
|
||||
|
||||
let encode_ids = match root_instance.class_name.as_str() {
|
||||
"DataModel" => root_instance.get_children_ids().to_vec(),
|
||||
_ => vec![root_id],
|
||||
};
|
||||
|
||||
let mut buffer = Vec::new();
|
||||
|
||||
log::trace!("Encoding XML model");
|
||||
let config = rbx_xml::EncodeOptions::new()
|
||||
.property_behavior(rbx_xml::EncodePropertyBehavior::WriteUnknown);
|
||||
rbx_xml::to_writer(&mut buffer, tree.inner(), &[root_id], config).context(XmlModel)?;
|
||||
|
||||
rbx_xml::to_writer(&mut buffer, tree.inner(), &encode_ids, config).context(XmlModel)?;
|
||||
|
||||
let url = format!(
|
||||
"https://data.roblox.com/Data/Upload.ashx?assetid={}",
|
||||
|
||||
Reference in New Issue
Block a user