You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: UsingCodeSnip.md
+45Lines changed: 45 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -17,6 +17,7 @@ If you can't find an answer to your question below, and you've read the program'
17
17
5.[How do I get CodeSnip to use a proxy server to access the internet?](#faq-5)
18
18
6.[How do I cross-reference my snippets using the "See also" field?](#faq-6)
19
19
7.[Delphi XE2 generates a "F1026 File not Found ?????.dcu" error when test compiling snippets. What's going wrong?](#faq-7)
20
+
8.[Why can't my portable edition of CodeSnip see the snippets I created in the standard edition (and vice versa)?](#faq-8)
20
21
21
22
## FAQ 1
22
23
@@ -179,3 +180,47 @@ At the time of writing, the following namespaces are required to compile all the
179
180
*`System.Win`
180
181
181
182
> Thanks to [geoffsmith82](https://sourceforge.net/u/geoffsmith82/profile/) for finding the cause of this problem.
183
+
184
+
## FAQ 8
185
+
186
+
**Why can't my portable edition of CodeSnip see the snippets I created in the standard edition (and vice versa)?**
187
+
188
+
The standard edition of CodeSnip stores your snippets in the Windows user application directory, by default. To be precise the snippets are in `%AppData%\DelphiDabbler\CodeSnip.4\UserDatabase`. I said "by default" because CodeSnip lets you move it!
189
+
190
+
Now, for a portable program to be portable it can't store data in any of the normal Windows directories because if you move the program the data files will get left behind. So your snippets can't be stored in the same place the standard edition stores them. In fact the portable edition stores your snippets in the `AppData\UserDB` sub directory of wherever you placed the CodeSnip executable - and it won't let you move it. That means that if you move CodeSnip to another location your snippets move with it.
191
+
192
+
So now we see that the portable edition and standard edition expect to find your snippets database in different places _by design_!
193
+
194
+
### Is there a way to copy the snippets over?
195
+
196
+
Yes. In fact there are two methods, _**But** you must understand that any edits you make in the portable app won't be reflected in the standard edition and vice versa_ - and you now know why!
197
+
198
+
> **WARNING: Do not attempt to copy the files manually. Use one of the methods below. If you do try this and it goes wrong don't come asking for help!**
199
+
200
+
#### Method 1: quick & dangerous!
201
+
202
+
> **WARNING: Use this method only if you are copying snippets to a CodeSnip installation that has no existing user defined snippets. They will be overwritten**
203
+
204
+
Follow these steps:
205
+
206
+
1. Run the edition of CodeSnip where you have stored your snippets.
207
+
2. Make a backup of your personal snippets. Use the _Database | Backup database_ menu option and choose a directory and file name to save the backup in. The name can be anything. Make a note of where you saved this file.
208
+
3. Run the edition of CodeSnip where you want to copy the snippets to.
209
+
4. Select the _Database | Restore user database_ menu option and navigate to the file you saved in in step 2. Select the file and click _OK_. After a wait you should see all your snippets appear.
210
+
211
+
#### Method 2: slower but safer
212
+
213
+
In this method we're going to merge snippets from one edition of CodeSnip with those in the other edition. I'll describe how to merge both ways, but you can choose to just do it in one direction by skipping a couple of steps.
214
+
215
+
Make sure you follow the instructions in order.
216
+
217
+
1. Start both editions of CodeSnip. We'll call them A and B. If only one edition has existing snippets, let that be CodeSnip A.
218
+
2.**Important** Just in case anything goes wrong **take backups** of both snippets databases, If one of the databases is empty you can skip the backup for that one. Use the _Database | Backup database_ menu option to do this.
219
+
3. Switch to CodeSnip A and export your snippets to a single file by using the _Snippets | Export Snippets_ menu option. In the resulting dialogue box select all your snippets. Specify a file name (say `A.csexp`) and click OK.
220
+
4. Switch to CodeSnip B. If it has snippets that you want to merge into CodeSnip A, then export those snippets using the same method as step 2. Name the file `B.csexp`.
221
+
5. While still in CodeSnip B, import the snippets from `A.csexp` that you exported from CodeSnip A. Do this using the _Snippets | Import Snippets_ menu option. This displays the _Import Wizard_. Follow the instructions in the wizard to perform the import (it has a help topic if you get stuck). Importantly the wizard lets you resolve any name conflicts between imported and existing snippets. **Note:** This import can take a _long_ time, especially if you have a lot of snippets. The GUI will flash horribly during the process!
222
+
6. Save the snippets by using the _Database | Save User Database_ menu option.
223
+
7. If you exported snippets from CodeSnip B then switch back to CodeSnip A and import the snippets from `B.csexp`. Use the same method described in steps 5 & 6.
224
+
8. All done. If you close and reopen both editions you should see the merged databases.
225
+
226
+
If anything went wrong you can restore the database(s) from the backups you took at step 2. Use the _Database | Restore user database_ menu option to do this. Unfortunately if you need to clear a database you have to delete the snippets one by one!
0 commit comments