mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
Implement encoding and decoding for Windows-invalid characters in file names
- Added `encode_path_name` and `decode_path_name` functions to handle encoding and decoding of invalid characters. - Updated `SyncbackRules` to include an option for encoding Windows-invalid characters during syncback. - Modified `name_for_inst` to conditionally encode invalid characters based on the new option. - Adjusted `ServeSession` and `InstanceContext` to support the new encoding feature. - Updated tests and snapshots to reflect changes in encoding behavior.
This commit is contained in:
parent
db87fa010f
commit
6d8c85682d
59 changed files with 350 additions and 53 deletions
|
|
@ -145,6 +145,11 @@ pub struct InstanceContext {
|
|||
pub emit_legacy_scripts: bool,
|
||||
#[serde(skip_serializing_if = "Vec::is_empty")]
|
||||
pub sync_rules: Vec<SyncRule>,
|
||||
/// Whether to decode Windows-invalid characters in file names.
|
||||
/// Characters like `%LT%`, `%GT%`, `%COLON%`, etc. will be decoded
|
||||
/// back to `<`, `>`, `:`, etc. in instance names sent to the plugin.
|
||||
#[serde(default)]
|
||||
pub decode_windows_invalid_chars: bool,
|
||||
}
|
||||
|
||||
impl InstanceContext {
|
||||
|
|
@ -153,6 +158,7 @@ impl InstanceContext {
|
|||
path_ignore_rules: Arc::new(Vec::new()),
|
||||
emit_legacy_scripts: emit_legacy_scripts_default().unwrap(),
|
||||
sync_rules: Vec::new(),
|
||||
decode_windows_invalid_chars: false,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -165,6 +171,10 @@ impl InstanceContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn set_decode_windows_invalid_chars(&mut self, decode: bool) {
|
||||
self.decode_windows_invalid_chars = decode;
|
||||
}
|
||||
|
||||
/// Extend the list of ignore rules in the context with the given new rules.
|
||||
pub fn add_path_ignore_rules<I>(&mut self, new_rules: I)
|
||||
where
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ metadata:
|
|||
relevant_paths: []
|
||||
context:
|
||||
emit_legacy_scripts: true
|
||||
decode_windows_invalid_chars: false
|
||||
specified_id: ~
|
||||
middleware: ~
|
||||
schema: ~
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ metadata:
|
|||
relevant_paths: []
|
||||
context:
|
||||
emit_legacy_scripts: true
|
||||
decode_windows_invalid_chars: false
|
||||
specified_id: ~
|
||||
middleware: ~
|
||||
schema: ~
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ metadata:
|
|||
relevant_paths: []
|
||||
context:
|
||||
emit_legacy_scripts: true
|
||||
decode_windows_invalid_chars: false
|
||||
specified_id: ~
|
||||
middleware: ~
|
||||
schema: ~
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ metadata:
|
|||
relevant_paths: []
|
||||
context:
|
||||
emit_legacy_scripts: true
|
||||
decode_windows_invalid_chars: false
|
||||
specified_id: ~
|
||||
middleware: ~
|
||||
schema: ~
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ added_instances:
|
|||
relevant_paths: []
|
||||
context:
|
||||
emit_legacy_scripts: true
|
||||
decode_windows_invalid_chars: false
|
||||
specified_id: ~
|
||||
middleware: ~
|
||||
schema: ~
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue