-
Notifications
You must be signed in to change notification settings - Fork 32.3k
Cannot Open Folder Suffixed ".Template" on macOS #247974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Okay, more explicit, a folder with any other text suffixed ".Template", I didn't mean literally the name ".Template" but something like "Project.Api.Template" or "New.App.Template". Suffixed ".Template", not named ".Template". |
I can reproduce in a fiddle, it seems when const { app, BrowserWindow, ipcMain, dialog } = require('electron');
const path = require('path');
app.whenReady().then(() => {
const win = new BrowserWindow({
width: 600,
height: 400,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
}
});
win.loadFile('index.html');
ipcMain.handle('select-folder', async () => {
const result = await dialog.showOpenDialog(win, {
properties: [
'openDirectory',
'treatPackageAsDirectory'
]
});
console.log(result);
return result.filePaths[0] || null;
});
}); <!DOCTYPE html>
<html>
<body>
<h2>Select a Folder</h2>
<button id="selectBtn">Choose Folder</button>
<p id="path"></p>
<script>
document.getElementById('selectBtn').addEventListener('click', async () => {
const folderPath = await window.electronAPI.selectFolder();
document.getElementById('path').textContent = folderPath || 'No folder selected';
});
</script>
</body>
</html> const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('electronAPI', {
selectFolder: () => ipcRenderer.invoke('select-folder')
}); |
@gilmorem560 but we explicitly set a flag to allow for drilling into |
Unfortunately that test doesn't, although if I had to wager a guess it's because it's literally just a directory, not a true ".app" as Apple defines it, so Cocoa probably says POSIX definition of a directory be damned, we're going to set the terms, not you. Edit: Just tried another, ".bundle", this one behaves similarly to ".Template" in that it is clickable in the file open dialog, but doesn't do anything. |
However, this is a bug in Electron since there is an option to allow to treat package apps as directory and it should be respected in this check that regressed this behavior. |
Addressed in electron/electron#47077 |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
When performing these steps, the Open Folder dialog closes but no visible change occurs in the VSCode application, it simply remains on whatever was already open, neither opening the new folder nor giving any sort of feedback that it did not do as requested.
Worth noting, opening said directory by passing it as an argument to "code" on the command-line does work, so the path is a standard UNIX directory listing out a series of files that can be viewed in the file tree in VSCode. For some reason it simply refuses to open if it is suffixed ".Template". This does not appear to happen outside of macOS.
The text was updated successfully, but these errors were encountered: