updated
This commit is contained in:
@@ -20,6 +20,7 @@ export function openApplovinUpload(_context: vscode.ExtensionContext) {
|
||||
canSelectMany: true,
|
||||
filters: { HTML: ['html', 'htm'] },
|
||||
openLabel: 'Select',
|
||||
defaultUri: getPickerDefaultUri(),
|
||||
});
|
||||
if (picked && picked.length) {
|
||||
panel.webview.postMessage({
|
||||
@@ -163,6 +164,17 @@ async function handleUpload(panel: vscode.WebviewPanel, filePaths: string[]) {
|
||||
panel.webview.postMessage({ type: 'done' });
|
||||
}
|
||||
|
||||
function getPickerDefaultUri(): vscode.Uri | undefined {
|
||||
const folders = vscode.workspace.workspaceFolders;
|
||||
if (!folders || folders.length === 0) return undefined;
|
||||
const root = folders[0].uri.fsPath;
|
||||
const dist = path.join(root, 'dist');
|
||||
if (fs.existsSync(dist) && fs.statSync(dist).isDirectory()) {
|
||||
return vscode.Uri.file(dist);
|
||||
}
|
||||
return vscode.Uri.file(root);
|
||||
}
|
||||
|
||||
function qrBaseName(name: string): string {
|
||||
return (name || 'qr').replace(/\.html?$/i, '').replace(/[\\/:*?"<>|]/g, '_') || 'qr';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user